redis服务

article/2025/8/28 20:20:03

 redis软件下载地址:Redis

redis支持的数据类型:

• 字符串(strings)
• 散列(hashes)
• 列表(lists)
• 集合(sets)
• 有序集合(sorted sets)

redis常用命令:

config get *查看配置
select 1选择数据库
flushdb清空当前数据库
flushall清空所有数据库
move key 1移动key
del key删除
rename oldkey newkey改名
expire key 10设置过期时间
persist key设置持久化
keys user*查询
exists key判断是否存在

 主从复制

[root@server1 ~]# scp westos@172.25.52.250:/home/westos/Downloads/qq-files/3459494803/file_recv/redis-6.2.4.tar.gz .
westos@172.25.52.250's password: 
redis-6.2.4.tar.gz                                               100% 2400KB  74.1MB/s   00:00    
[root@server1 ~]# tar -zxvf redis-6.2.4.tar.gz 
[root@server1 ~]# cd redis-6.2.4/
[root@server1 redis-6.2.4]# ls
[root@server1 redis-6.2.4]# make
[root@server1 redis-6.2.4]# make install

 [root@server1 redis-6.2.4]# vim utils/install_server.sh   ###将78-84行注释掉

[root@server1 redis-6.2.4]# cd utils/ 
[root@server1 utils]# ./install_server.sh ##执行脚本
Welcome to the redis service installer
This script will help you easily set up a running redis serverPlease select the redis port for this instance: [6379] 
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] 
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] 
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] 
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server] 
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
[root@server1 utils]# ls
build-static-symbols.tcl  hyperloglog            speed-regression.tcl
cluster_fail_time.tcl     install_server.sh      srandmember
corrupt_rdb.c             lru                    systemd-redis_multiple_servers@.service
create-cluster            redis-copy.rb          systemd-redis_server.service
generate-command-help.rb  redis_init_script      tracking_collisions.c
gen-test-certs.sh         redis_init_script.tpl  whatisdoing.sh
graphs                    redis-sha1.rb
hashtable                 releasetools
[root@server1 utils]# cd /etc/redis/
[root@server1 redis]# ls
6379.conf
[root@server1 redis]# vim 6379.conf 76 bind 0.0.0.0

[root@server1 redis]# /etc/init.d/redis_6379 restart
Stopping ...
Redis stopped
Starting Redis server...
[root@server1 redis]# netstat -anttlp
[root@server1 redis-6.2.4]# redis-cli  ###登陆

 

在server2中: 

[root@server2 ~]# tar -zxvf redis-6.2.4.tar.gz
[root@server2 ~]# cd redis-6.2.4/
[root@server2 redis-6.2.4]# make

[root@server2 redis-6.2.4]# ls
[root@server2 redis-6.2.4]# make install

[root@server2 redis-6.2.4]# vim utils/install_server.sh  ###将其注释

 [root@server2 utils]# ./install_server.sh   ##执行脚本

[root@server2 utils]# cd /etc/redis/
[root@server2 redis]# ls
6379.conf
[root@server2 redis]# vim 6379.conf 76 bind 0.0.0.0479 replicaof 172.25.52.1 6379[root@server2 redis]# /etc/init.d/redis_6379 restart
Stopping ...
Redis stopped
Starting Redis server...
[root@server2 redis]# netstat -anttlp

 

 测试:

[root@server1 redis-6.2.4]# ps aux | grep redis
root      8266  0.1  0.4 198016 10100 ?        Ssl  10:36   0:04 /usr/local/bin/redis-server 0.0.0.0:6379
root      8307  0.0  0.0 112708   972 pts/0    R+   11:32   0:00 grep --color=auto redis
[root@server1 redis-6.2.4]# /etc/init.d/redis_6379 stopn    ###stop停止
Stopping ...
Redis stopped
[root@server1 redis-6.2.4]# cat /var/log/redis_6379.log ##查看日志

将server3也添加slave

在server2中:

[root@server2 ~]# scp redis-6.2.4.tar.gz server3:    ##传给server3

 在server3中:

[root@server3 ~]# tar zxf redis-6.2.4.tar.gz 
[root@server3 ~]# yum install -y gcc make
[root@server3 ~]# ls
anaconda-screenshots  redis-6.2.4  redis-6.2.4.tar.gz
[root@server3 ~]# cd redis-6.2.4/
[root@server3 redis-6.2.4]# make && make install
[root@server3 redis-6.2.4]# cd utils/
[root@server3 utils]# vim install_server.sh    ####注释78 #if [ "${_pid_1_exe##*/}" = systemd ]79 #then80 #       echo "This systems seems to use systemd."81 #       echo "Please take a look at the provided example service unit files in this directory, a    nd adapt and install them. Sorry!"82 #       exit 183 #fi
[root@server3 utils]# ./install_server.sh  ##执行脚本

 

[root@server3 utils]# vim /etc/redis/6379.conf bind 0.0.0.06379 replicaof 172.25.52.1 6379[root@server3 utils]# /etc/init.d/redis_6379 restart    ##重启
[root@server3 utils]# ps ax | grep redis8093 ?        Ssl    0:00 /usr/local/bin/redis-server 0.0.0.0:63798099 pts/0    S+     0:00 grep --color=auto redis
[root@server3 utils]# netstat -antlp   ##查看端口

 已经搭建好了主从,测试一下:

 

 在server2中:

[root@server2 ~]# redis-cli       ###查看master
127.0.0.1:6379> info

  在server3中:

[root@server3 utils]# redis-cli    ###查看master  
127.0.0.1:6379> info

主从切换--- 配置sentinel

[root@server1 redis-6.2.4]# ls
00-RELEASENOTES  CONTRIBUTING  INSTALL    README.md   runtest-cluster    sentinel.conf  TLS.md
BUGS             COPYING       Makefile   redis.conf  runtest-moduleapi  src            utils
CONDUCT          deps          MANIFESTO  runtest     runtest-sentinel   tests
[root@server1 redis-6.2.4]# cp sentinel.conf /etc/redis/
[root@server1 redis-6.2.4]# cd /etc/redis/
[root@server1 redis]# ls
6379.conf  sentinel.conf
[root@server1 redis]# vim sentinel.conf    ##修改之后传给server2和servver3,注意要在重启之前26 daemonize no    84 sentinel monitor mymaster 172.25.52.1 6379 2125 sentinel down-after-milliseconds mymaster 10000[root@server1 redis]# ls
6379.conf  sentinel.conf
[root@server1 redis]# pwd
/etc/redis
[root@server1 redis]# scp sentinel.conf server2:/etc/redis/
[root@server1 redis]# scp sentinel.conf server3:/etc/redis/

 

[root@server2 redis]# redis-sentinel /etc/redis/sentinel.conf 

[root@server3 utils]# redis-sentinel /etc/redis/sentinel.conf

 将server1停掉:

[root@server1 ~]# redis-cli
127.0.0.1:6379> SHUTDOWN
not connected> exit
[root@server1 ~]# ps ax | grep redis8451 ?        Ssl    0:06 redis-sentinel *:26379 [sentinel]8662 pts/1    S+     0:00 grep --color=auto redis
[root@server1 ~]# 
然后去看监控:------>可以看到master变了,3经过投票变为新的master

 测试是否切换成功:
[root@server3 ~]# redis-cli    ###在server3查看信息
127.0.0.1:6379> info

 [root@server2 ~]# redis-cli
127.0.0.1:6379> info

[root@server1 ~]# /etc/init.d/redis_6379 start
Starting Redis server...
[root@server1 ~]# ps ax | grep redis
 8451 ?        Ssl    0:09 redis-sentinel *:26379 [sentinel]
 8687 ?        Ssl    0:00 /usr/local/bin/redis-server 0.0.0.0:6379
 8695 pts/1    S+     0:00 grep --color=auto redis
[root@server1 ~]# redis-cli    ###将server1启动之后,会自动变成slave端连接在master(server3)上
127.0.0.1:6379> info

 

  建立集群

[root@server3 utils]# netstat -antlp | grep :6379
[root@server1 redis]# iptables -L
[root@server1 redis]# /etc/init.d/redis_6379 stop
Stopping ...
Redis stopped
[root@server1 redis]# cd
[root@server1 ~]# cd redis-6.2.4/
[root@server1 redis-6.2.4]# ls
[root@server1 redis-6.2.4]# cd utils/
[root@server1 utils]# cd create-cluster/
[root@server1 create-cluster]# ls
create-cluster  README
[root@server1 create-cluster]# ./create-cluster start
Starting 30001
Starting 30002
Starting 30003
Starting 30004
Starting 30005
Starting 30006
[root@server1 create-cluster]# ps ax | grep redis

[root@server1 create-cluster]# pwd
/root/redis-6.2.4/utils/create-cluster
[root@server1 create-cluster]# ls
[root@server1 create-cluster]# cat 30001.log   ###日志文件

[root@server1 create-cluster]# sysctl -w vm.overcommit_memory=1  ##
vm.overcommit_memory = 1
[root@server1 create-cluster]# cat appendonly-30001.aof 
[root@server1 create-cluster]# ls
[root@server1 create-cluster]# ./create-cluster createCan I set the above configuration? (type 'yes' to accept): yes

 

 [root@server1 create-cluster]# redis-cli --cluster check 127.0.0.1:30001

生成三组:

30005对应的master是30002,30004对应的master是30001,30006对应的master是30003

root@server1 create-cluster]# redis-cli -c -p 30001
127.0.0.1:30001> get name
-> Redirected to slot [5798] located at 127.0.0.1:30002
(nil)
127.0.0.1:30002> set name westos
OK
127.0.0.1:30002> get name
"westos"
127.0.0.1:30002> info

[root@server1 create-cluster]# redis-cli -c -p 30004
127.0.0.1:30004> get name
-> Redirected to slot [5798] located at 127.0.0.1:30002
"westos"
127.0.0.1:30002> info 

 

[root@server1 create-cluster]# pwd
/root/redis-6.2.4/utils/create-cluster
[root@server1 create-cluster]# redis-cli -c -p 30002
127.0.0.1:30002> get name
"redhat"
127.0.0.1:30002> SHUTDOWN     #####将2down掉
not connected> exit
[root@server1 create-cluster]# ps ax
[root@server1 create-cluster]# ./create-cluster start
[root@server1 create-cluster]# redis-cli --cluster check 127.0.0.1:30003  ##可以看到30005变为master

 

 

将5和2都SHUTDOWN:
[root@server1 create-cluster]# redis-cli -c -p 30005
127.0.0.1:30005> SHUTDOWN
not connected> exit
[root@server1 create-cluster]# redis-cli -c -p 30002
127.0.0.1:30002> get name
"redhat"
127.0.0.1:30002> SHUTDOWN
not connected> exit
[root@server1 create-cluster]# redis-cli --cluster check 127.0.0.1:30003

 测试:一组出问题------->全部崩

解决:重新开启

注意:哈西槽一定要够,否则会崩盘,删除一组就崩盘

配置文件改为8就一次产生8个 

 

[root@server1 create-cluster]# redis-cli --cluster add-node 127.0.0.1:30007 ##添加master7127.0.0.1:30001
[root@server1 create-cluster]# redis-cli --cluster check 127.0.0.1:30003添加30007的slave 30008:
[root@server1 create-cluster]# redis-cli --cluster add-node 127.0.0.1:30008 127.0.0.1:30001 --cluster-slave --cluster-master-id 6d173bb37636898319d71d063bb3f06a84ea8dd7

 

[root@server1 create-cluster]# redis-cli --cluster check 127.0.0.1:30003   ###8个

 给30007分配哈西槽:

[root@server1 create-cluster]# redis-cli --cluster reshard 127.0.0.1:30003
How many slots do you want to move (from 1 to 16384)? 1000
What is the receiving node ID? 6d173bb37636898319d71d063bb3f06a84ea8dd7
Please enter all the source node IDs.Type 'all' to use all the nodes as source nodes for the hash slots.Type 'done' once you entered all the source nodes IDs.
Source node #1: all[root@server1 create-cluster]# redis-cli --cluster check 127.0.0.1:30003  ###去测试添加是否成功

 [root@server1 create-cluster]# redis-cli -c -p 30003

 

 PHP与redis连接

 [root@server1 create-cluster]# ./create-cluster stop

[root@server2 redis]# /etc/init.d/redis_6379 stop

留下server3(master)

 [root@server4 local]# yum install  -y mariadb-server
[root@server4 local]# systemctl start mariadb.service
[root@server4 local]# cd /var/lib/mysql/
[root@server4 mysql]# mysql

[root@server2 redis]# /etc/init.d/redis_6379 stop
Stopping ...
Redis stopped
[root@server2 redis]# cd
[root@server2 ~]# ls
anaconda-screenshots  mysql-5.7.31  mysql-boost-5.7.31.tar.gz  redis-6.2.4  redis-6.2.4.tar.gz
[root@server2 ~]# scp westos@172.25.52.250:/home/westos/Downloads/qq-files/3459494803/file_recv/php-fpm-5.4.16-46.el7.x86_64.rpm .
westos@172.25.52.250's password: 
php-fpm-5.4.16-46.el7.x86_64.rpm                                       100% 1451KB  66.5MB/s   00:00    
[root@server2 ~]# ps ax
[root@server2 ~]# netstat -antlp   ###确保实验环境干净

[root@server2 ~]# yum install -y php-fpm-5.4.16-46.el7.x86_64.rpm[root@server2 ~]# cd /etc/php-fpm.d/
[root@server2 php-fpm.d]# ls
www.conf
[root@server2 php-fpm.d]# vim www.conf ; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

 

 安装nginx:

[root@server2 php-fpm.d]# cd
[root@server2 ~]# scp westos@172.25.52.250:/home/westos/Desktop/企业部分/软件包/nginx-1.20.2.tar.gz .
westos@172.25.52.250's password: 
nginx-1.20.2.tar.gz                                                    100% 1037KB  26.9MB/s   00:00    
[root@server2 ~]# ls
anaconda-screenshots  mysql-boost-5.7.31.tar.gz  php-fpm-5.4.16-46.el7.x86_64.rpm  redis-6.2.4.tar.gz
mysql-5.7.31          nginx-1.20.2.tar.gz        redis-6.2.4
[root@server2 ~]# tar zxf nginx-1.20.2.tar.gz 
[root@server2 ~]# cd nginx-1.20.2/
[root@server2 nginx-1.20.2]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
[root@server2 nginx-1.20.2]# yum install -y gcc pcre-devel zlib-devel openssl-devel
[root@server2 nginx-1.20.2]# ./configure --with-http_ssl_module
[root@server2 nginx-1.20.2]# make && make install
[root@server2 nginx-1.20.2]# ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/
[root@server2 nginx-1.20.2]# which nginx
/usr/local/bin/nginx

[root@server2 conf]# useradd -s /sbin/nologin -M -d /user/local/nginx nginx
[root@server2 conf]# id nginx
uid=1001(nginx) gid=1001(nginx) groups=1001(nginx)
[root@server2 conf]# ls
[root@server2 conf]# vim nginx.conf
[root@server2 conf]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@server2 conf]# nginx 
[root@server2 conf]# ps ax | grep nginx
[root@server2 conf]# curl localhost

 

[root@server2 conf]# cd /etc/php-fpm.d/
[root@server2 php-fpm.d]# ls
www.conf
[root@server2 php-fpm.d]# vim www.conf 
[root@server2 php-fpm.d]# systemctl start php-fpm  ##开启
[root@server2 php-fpm.d]# ps ax    ##查看进程
[root@server2 php-fpm.d]# netstat -antlp 

[root@server2 ~]# scp westos@172.25.52.250:/home/westos/Downloads/qq-files/3459494803/file_recv/test* .
westos@172.25.52.250's password: 
test                                                                   100% 5020     4.4MB/s   00:00    
test.php                                                               100% 1369   297.6KB/s   00:00    
test.sql                                                               100%  502   649.5KB/s   00:00    
[root@server2 ~]# ls
[root@server2 ~]# cp test.php /usr/local/nginx/html/
[root@server2 ~]# cd /usr/local/nginx/html/
[root@server2 html]# vim test.php 
[root@server3 ~]# /etc/init.d/redis_6379 start
Starting Redis server...
[root@server3 ~]# redis-cli 
127.0.0.1:6379> info

 

 [root@server2 ~]# scp test.sql server4:

[root@server4 mysql]# cd
[root@server4 ~]# vim test.sql
[root@server4 ~]# cat test.sql
[root@server4 ~]# mysql test < test.sql
[root@server4 ~]# mysqlMariaDB [(none)]> use testMariaDB [test]> show tables;MariaDB [test]> select * from test;MariaDB [test]> grant all on test.* to redis@'%' identified by 'westos';

[root@server2 ~]# yum install -y php
[root@server2 ~]# php -m | grep php
[root@server2 ~]# php -m | grep mysql
[root@server2 ~]# yum install -y php-mysql

 

[root@server2 ~]# php -m | grep mysql
mysql
mysqli
pdo_mysql
[root@server2 ~]# ls
[root@server2 ~]# php -m | grep redis
[root@server2 ~]# scp westos@172.25.52.250:/home/westos/Downloads/qq-files/3459494803/file_recv/php-pecl-redis-* .
westos@172.25.52.250's password: 
php-pecl-redis-2.2.8-1.el7.x86_64.rpm                                  100%  155KB  46.6MB/s   00:00   
[root@server2 ~]# scp westos@172.25.52.250:/home/westos/Downloads/qq-files/3459494803/file_recv/php-pecl-igbinary* .
westos@172.25.52.250's password: 
php-pecl-igbinary-1.2.1-1.el7.x86_64.rpm                               100%   38KB  21.9MB/s   00:00    
[root@server2 ~]# ls
anaconda-screenshots       nginx-1.20.2.tar.gz                    redis-6.2.4.tar.gz
mysql-5.7.31               php-fpm-5.4.16-46.el7.x86_64.rpm       test
mysql-boost-5.7.31.tar.gz  php-pecl-redis-2.2.8-1.el7.x86_64.rpm  test.php
nginx-1.20.2               redis-6.2.4                            test.sql[root@server2 ~]# yum install -y php-pecl-redis-2.2.8-1.el7.x86_64.rpm php-pecl-igbinary-1.2.1-1.el7.x86_64.rpm

在浏览器中访问:http://172.25.52.2/test.php

 

在server4中修改之后::

[root@server3 ~]# redis-cli    ###redis 不变
127.0.0.1:6379> get 1
"test1"
127.0.0.1:6379> get 2
"test2"
127.0.0.1:6379> get 3
"test3"
127.0.0.1:6379> get 4
"test4"
127.0.0.1:6379> get 1    ###数据库修改后客户端没有同步
"test1"
127.0.0.1:6379> del 1   ##redis删除之后会重新从数据库加载数据到用户端(网页)
(integer) 1
127.0.0.1:6379> get 1
(nil)
127.0.0.1:6379> get 1
(nil)
127.0.0.1:6379> get 2
"test2"
127.0.0.1:6379> set 1 test1     ###在redis中修改数据后,客户端会立即更新
OK
127.0.0.1:6379> 

 redis中删除之后会重新从数据库加载数据到用户端(网页)

 在redis中修改数据后,客户端会立即更新:

 

 没有实现mysql数据库与redis的数据同步,后续补充。


http://chatgpt.dhexx.cn/article/NIBD2K2L.shtml

相关文章

Redis添加到系统服务

一、需求 当我们使用Redis时&#xff0c;需要启动Redis服务&#xff0c;然后才能够在客户端使用&#xff0c;在这里推荐使用一个Redis的客户端管理工具 redisdesktopmanager&#xff0c;每次在控制台打开Redis服务之后&#xff0c;都不能够将该窗口关闭&#xff0c;因为一旦关…

windows redis 后台启动 redis 服务

下载Redis 在Redis的官网下载页上有各种各样的版本&#xff0c;我这次是在windows上部署的&#xff0c;要去GitHub上下载。目前的是2.8.12版的&#xff0c;直接解压&#xff0c;在\bin\release 目录下有个压缩包&#xff0c;这就是我们需要的&#xff1a; 启动Redis 直接在上…

Redis服务部署

这里写自定义目录标题 一.关系型数据与非关系型数据1.1关系型数据库1.2非关系型数据库1.3关系型数据库和非关系型数据库区别1.4非关系型数据库产生背景 二.Redis简介2.1Redis概述2.2Redis优点 三.Redis服务部署四.Redis常用命令4.1Redis工具4.2Redis数据库常用命令4.3密码设置4…

手机短信验证码

阿里短信手机短信验证码功能 使用阿里短信服务管理 注册 登录阿里云 进入控制台 选择短信服务 开通短信服务价格大概0.04元一条 貌似有100条免费试用。 点击新手指导可查看文档 1 按照顺序进行注册登录实名认证 2 创建AccessKey 3 进入短信服务控制台 创建签名管理 签名模板…

短信验证码

写一个发送验证码的功能&#xff0c;需要实现第三方接口&#xff0c;一般采用阿里的接口 第一步:登录阿里大于官网&#xff0c;只需淘宝号即可。 第二步&#xff1a;申请验证码中的签名和短信模板&#xff0c;审核通过即可测试 第三步&#xff1a;下载阿里大于的jar包&#xff…

Win-mac版 AE 2018安装附教程

链接:https://pan.baidu.com/s/17QXFuotLoPmqDQa8DBBRrA?pwdw106 提取码:w106

AE2022最新功能简介

没有什么是您无法使用 After Effects 创建的。 创建电影电影标题、简介和转场。从剪辑中移除对象。生火或下雨。为徽标或角色设置动画。甚至在 3D 空间中导航和设计。借助行业标准的 动态图形 和 视觉效果软件After Effects&#xff0c;您可以将任何想法付诸实践。 ​下载&…

AE圣诞树(html版本),免费

最近网上很火的AE圣诞树&#xff0c;这里免费提供给大家HTML版本 源码和视频下载&#xff1a;https://download.csdn.net/download/qq_56088882/87260627

最新版Adobe2023:After Effects 2023(Ae2023) win/mac版中文特别版

Adobe After Effects 2023(AE2023)它用于视频处理后期制作、创建音乐视频、广告、动画、标题以及许多其他需要数字视频效果的元素。Adobe After Effects提供了出色的控制功能、广泛的创意工具以及与其他视频应用程序集成的能力。由于第三方开发的大量插件库&#xff0c;Adobe A…

解决PR AE 2018打不开,且桌面出现报错文件

1.win11系统安装完pr2018之后&#xff0c;出现了如下报错的文件。 2.排查 安装包是之前笔记本常用的一直没报错&#xff0c;用压缩包封装着不存在文件的缺失。 经过查阅Adobe官方文档发现这是版本未优化的BUG,大部分存在于使用独显的电脑。有相关问题的朋友可以尝试替换高版本…

水清冷冷:AE CC2018安装图文教程攻略(附工具),windows系统64位

工具分享在底部 随着短视频时代热潮到来&#xff0c;水清冷冷觉得&#xff0c;一些懂视频剪辑和特效制作的人才也越来越吃香&#xff0c;自己做自媒体或帮企业制作视频等&#xff0c;都能有好的发展前景。当然像PR剪辑软件和AE特效制作软件还是需要一定的专业水平的&#xff0c…

星际争霸2人工智能研究环境SC2LE完全入门指南

&#xfeff;&#xfeff; 迈向通用人工智能&#xff1a;星际争霸2人工智能研究环境SC2LE完全入门指南 Kun Ni 飞行器控制专业博士 86 人赞了该文章 题图来源&#xff1a;http://www.neogaf.com/forum/showthread.php?t1401417&amp;amp;amp;amp;page1 版权说明&#xff1a…

QT学习之基础Day1(自用)

1.Qt是什么&#xff1f; Qt&#xff08;官方发音 [kju:t]&#xff0c;音同 cute&#xff09;是一个跨平台的 C 开发库&#xff0c;主要用来开发图形用户界面&#xff08;Graphical User Interface&#xff0c;GUI&#xff09;程序&#xff0c;当然也可以开发不带界面的命令行&…

Spring学习(六):WebFlux

文章目录 WebFlux概述简介异步非阻塞 响应式编程简介Reactor实现简介三种信号特点操作符示例代码 SpringWebflux执行流程和核心API执行流程核心API SpringWebflux基于注解编程SpringWebflux基于函数式编程具体步骤示例代码 WebFlux概述 简介 WebFlux是Spring5新添加的模块以用…

Spring Web vs Spring Webflux

当你需要构建Web应用程序时&#xff0c;Spring Web 和 Spring Webflux 是Spring生态系统中的两个框架&#xff0c;但它们之间有一些关键区别。 Spring Web 是一个传统的Web框架&#xff0c;它构建在Servlet API之上。它旨在处理阻塞式I/O&#xff0c;即线程在从数据库或其他服务…

Spring Boot(5)之 WebFlux 响应式编程

1、WebFlux简介 springWebFlux 是 SpringFrameworl5.0 添加的新功能&#xff0c;WebFlux 本身是追随当下最火的 Reactive Programming 而诞生的框架&#xff0c;那么本编就来简述下这个框架到底是做什么的。 参考&#xff1a;Spring-WebFlux简介与使用 1.1、关于WebFlux 我们…

对比WebFlux和WebMVC (为什么使用WebFlux)

对比WebFlux和WebMVC (为什么使用WebFlux) 1.0 WebFlux吞吐量对比WebMVC 2.0 WebFlux延迟/CPU对比WebMVC 3.0 WebFlux内存使用对比WebMVC 4.0 WebFlux最大处理请求对比WebMVC 1

Spring(十)Webflux

Webflux 1、SpringWebflux 介绍 &#xff08;1&#xff09;是 Spring5 添加新的模块&#xff0c;用于 web 开发的&#xff0c;功能和 SpringMVC 类似的&#xff0c;Webflux 使用当前一种比较流程响应式编程出现的框架。 &#xff08;2&#xff09;使用传统 web 框架&#xff…

Spring:Webflux响应式编程

目录 简介响应式编程Reactor信号操作符 SpringWebflux 执行流程和API 注解实现SpringWebflux 说明&#xff1a;基于atguigu学习笔记。 简介 Webflux是 Spring5 添加新的模块&#xff0c;用于 web 开发的&#xff0c;功能和 SpringMVC 类似的&#xff0c;Webflux 使用当前一种比…

WebFlux入门详解

文章目录 一、 WebFlux介绍1、什么是 WebFlux2、反应式库介绍2.1 Reactive Stream2.2 Reactor2.3 Reactive Stream、Reactor 和 WebFlux 关系 二、入门WebFlux1、简单介绍2、简单的例子构造 三、WebFlux与数据库1、介绍2、r2dbc实战前期准备2.1 引入依赖与配置2.2 创建数据表2.…