负载均衡项目中解决Session保留问题

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)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值