Linux网络服务_squid集群

Linux网络服务_squid集群

squid集群,一台主机作为调度器,其他主机作为服务器,轮流处理
平衡轮训,一次一个解决一个
使用3台虚拟机172.25.254.100 172.25.254.103 172.25.254.203(作为调度),真机访问
调度机中

vim /etc/squid/squid.conf
cache_peer 172.25.254.103 parent 80 0 no-query originserver round-robin name=webserver1
cache_peer 172.25.254.100 parent 80 0 no-query originserver round-robin name=webserver2
cache_peer_domain webserver1 webserver2 www.westos.com

//orginserver 设置预主机的方式round-rebin 设置方式为轮寻
//name=webserver1名称设定成web1
重启服务systemctl restart squid.service
本地解析

vim /etc/hosts
172.25.254.203 www.westos.com news.westos.com music.westos.com money.westos.com login.westos.com

查看帮助less /usr/share/doc/squid-3.3.8/squid.conf.documented
测试:浏览器输入www.westos.com,轮寻为刷新一个切换一台处理机

Linux网络服务_squid集群

Linux网络服务_squid集群

链路集合bond —>2个网卡的阵列,只能2块
添加网卡

Linux网络服务_squid集群

查看现有的网络设备 nmcli connection show
删除网络设备 nmcli connection delete eth0
查看网卡 ifconfig

Linux网络服务_squid集群

创建bond0 nmcli connection add con-name bond0 ifname bond0 type bond ip4 172.25.254.103/24

Linux网络服务_squid集群

检测,ping 172.25.254.3 此时ping不通
监控watch -n 1 cat /proc/net/bonding/bond0
ping 172.25.254.3 —> eth0/1切换时网不断
删除bond0 nmcli connection delete bond0
创建bond0 nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.103/24
把eth0添加到bond上 nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0
测试 ping172.25.254.3 能够连接上
把bond上ip分配给eth1 nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0

Linux网络服务_squid集群

测试: 破坏eth0 ifconfig eth0 down

Linux网络服务_squid集群

恢复eth0 ifconfig eth0 up

Linux网络服务_squid集群

破坏eth1 ifconfig eth1 down

Linux网络服务_squid集群

恢复eth1 ifconfig eth1 up

Linux网络服务_squid集群


平衡轮寻
多块网卡 team //企业7以上才有
删除之前做的 nm-connection-editor中删除所有
查看 ifconfig
创建team0 nmcli connection add type team con-name team0 ifname team0 config ‘{“runner”:{“name”:”activebackup”}}’ ip4 172.25.254.103/24

Linux网络服务_squid集群

config ‘{“runner”:{“name”:”activebackup”}}’ ip4 172.25.254.103/24
监控 watch -n 1 teamdctl team0 state
ping 172.25.254.3
把team上ip分配给eth0
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
把team上ip分配给eth1

Linux网络服务_squid集群

测试:
破坏eth0 ifconfig eth0 down
恢复eth0 ifconfig eth0 up
破坏eth1 ifconfig eth1 down
恢复eth1 ifconfig eth1 up

Linux网络服务_squid集群