1.利用ip_hash,将一个客户端固定调度到一个Web节点实现session保留。
upstream nodes {
ip_hash;
server 192.168.99.201;
server 192.168.99.202;
server 192.168.99.203;
}
2.利用Redis配置Session共享
*@Redis Server(192.168.99.131)*
yum install redis -y
vim /etc/redis.conf
[root@localhost ~]# grep -v ^# /etc/redis.conf | grep bind
bind 127.0.0.1 192.168.99.131
systemctl enable --now redis
firewall-cmd --add-service=redis
firewall-cmd --add-service=redis --per
ss -ltpn
*@Web节点*
**为php安装redis扩展**
1)下载phpredis
yum install git -y
git clone https://github.com/phpredis/phpredis.git
如无法访问GitHub,可用访问gitclone.com下载
git clone https://gitclone.com/github.com/phpredis/phpredis
2)为编译准备PHP扩展
[root@web03 phpredis]# cd phpredis
[root@web03 phpredis]# phpize
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
发现缺少php-devel包
3)