91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

heartbeat+ipvs+keepalived

發布時間:2020-07-18 13:25:21 來源:網絡 閱讀:1197 作者:2017lw 欄目:建站服務器

1.高可用Heartbeat

Server1server4安裝資源包

   heartbeat-3.0.4-2.el6.x86_64.rpm

   heartbeat-devel-3.0.4-2.el6.x86_64.rpm

   heartbeat-libs-3.0.4-2.el6.x86_64.rpm

   ldirectord-3.9.5-3.1.x86_64.rpm

yum install -y heartbeat-*

[root@server1 ha.d]# cd /usr/share/doc/heartbeat-3.0.4/

[root@server1 heartbeat-3.0.4]# cp ha.cf authkeys haresources /etc/ha.d/

[root@server1 heartbeat-3.0.4]# cd /etc/ha.d

[root@server1 ha.d]# vim ha.cf

heartbeat+ipvs+keepalived

heartbeat+ipvs+keepalived

heartbeat+ipvs+keepalived

heartbeat+ipvs+keepalived

[root@server1 ha.d]# vim authkeys

heartbeat+ipvs+keepalived

[root@server1 ha.d]# chmod 600 authkeys 

[root@server1 ha.d]# vim haresources 

heartbeat+ipvs+keepalived

[root@server1 ha.d]# scp ha.cf authkeys haresources server4:/etc/ha.d

[root@server1 ha.d]# /etc/init.d/heartbeat start

Server4做相同的操作

[root@server4 ha.d]# /etc/init.d/heartbeat start

測試:

heartbeat+ipvs+keepalived

[root@server1 ha.d]# /etc/init.d/heartbeat stop

heartbeat+ipvs+keepalived

[root@server1 ha.d]# /etc/init.d/heartbeat start

heartbeat+ipvs+keepalived

 

1.ipvs負載均衡

首先停掉server1server4上的heartbeat

Server1上的操作,并且server1做調度器

[root@server1 ~]# yum install -y ldirectord-3.9.5-3.1.x86_64.rpm

[root@server1 ~]# cd /usr/share/doc/ldirectord-3.9.5/

[root@server1 ldirectord-3.9.5]# cp ldirectord.cf /etc/ha.d

[root@server1 ~]# yum install -y ipvsadm

[root@server1 ~]# ipvsadm -L  

[root@server1 ~]# ipvsadm -C   ##清除規則

[root@server1 ~]# ipvsadm -A -t 172.25.6.100:80 -s rr    ##rr表示采用輪詢調度算法,添加新的虛擬ip

[root@server1 ~]# ip addr add 172.25.6.100/24 dev eth0

[root@server1 ~]# ip addr

heartbeat+ipvs+keepalived

[root@server1 ~]# ipvsadm -a -t 172.25.6.100:80 -r 172.25.6.2:80 -g   ##添加新規則

[root@server1 ~]# ipvsadm -a -t 172.25.6.100:80 -r 172.25.6.3:80 -g

[root@server1 ~]# /etc/init.d/ipvsadm save   ##保存添加的規則

 [root@server1 ~]# ipvsadm -L      ##顯示內核中虛擬服務器列表

heartbeat+ipvs+keepalived

[root@server1 ~]# /etc/init.d/httpd restart

Server2上的操作

[root@server2 ~]# ip addr add 172.25.6.100/32 dev eth0

[root@server2 ~]# ip addr

heartbeat+ipvs+keepalived

[root@server2 ~]# yum install -y arptables_jf

[root@server2 html]# arptables -A IN -d 172.25.6.100 -j DROP

[root@server2 html]# arptables -A OUT -s 172.25.6.200 -j mangle --mangle-ip-s 172.25.6.2

[root@server2 html]# /etc/init.d/arptables_jf  save

[root@server2 html]# /etc/init.d/httpd restart

Server3上的操作

[root@server3 ~]# /etc/init.d/httpd start

[root@server3 ~]# ip addr add 172.25.6.100/32 dev eth0   ##給內網網卡添加ip

[root@server3 ~]# ip addr

heartbeat+ipvs+keepalived

[root@server3 ~]# yum install -y arptables_jf

[root@server3 html]# arptables -A IN -d 172.25.6.100 -j DROP  ##給這個地址追加策略

[root@server3 html]# arptables -A OUT -s 172.25.6.100 -j  mangle --mangle-ip-s 172.25.6.3  ##追加策略,由100源地址跳到3上

[root@server3 ~]# /etc/init.d/arptables_jf save  ##保存添加的策略

[root@server3 ~]# /etc/init.d/arptables_jf start 

[root@server3 ~]# /etc/init.d/httpd restart

 

測試:

heartbeat+ipvs+keepalived 

2.高可用與負載均衡

[root@server1 ~]# yum install -y ldirectord-3.9.5-3.1.x86_64.rpm

[root@server1 ~]# cd /etc/ha.d/

[root@server1 ha.d]# vim ldirectord.cf 

heartbeat+ipvs+keepalived

[root@server1 ha.d]# ipvsadm -C  ##清除策略

[root@server1 ha.d]# ipvsadm -L   ##查看策略

[root@server1 ha.d]# ip addr del 172.25.6.100/24 dev eth0    ##刪除內網網卡上的ip

[root@server1 ha.d]# vim haresources 

heartbeat+ipvs+keepalived

[root@server1 ha.d]# scp haresources ldirectord.cf  172.25.6.4:/etc/ha.d/      ##server4上做與server1相同的操作

打開server4上的heartbeat替代server1heartbeat

[root@server1 html]# /etc/init.d/httpd restart

測試:

如果server2server3httpd打開

heartbeat+ipvs+keepalived

如果server2server3  httpd關閉,則訪問heartbeat所在的主機

heartbeat+ipvs+keepalived

4.keepalived

關閉server1server4heartbeat,打開server2server3httpd

Server1上的操作

[root@server1 ~]# tar zxf keepalived-1.2.20.tar.gz

[root@server1 ~]#cd keepalived-1.2.20/

[root@server1 keepalived-1.2.20]# ./configure --prefix=/usr/local/keepalived/  ##解譯到指定路徑

[root@server1 keepalived-1.2.20]# make &&  make install

[root@server1 keepalived-1.2.20]# cd /usr/local/keepalived/

[root@server1 local]# scp -r keepalived/ 172.25.6.4:/usr/local/

[root@server1 sbin]#

 ln -s /usr/local/keepalived/sbin/keepalived /sbin/

[root@server1 etc]# ln -s /usr/local/keepalived/etc/keepalived/ /etc/

[root@server1 sysconfig]#

 ln -s /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

[root@server1 sysconfig]#

 ln -s /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/

[root@server1 init.d]# chmod +x keepalived

[root@server1 init.d]# cd /etc/keepalived/

[root@server1 keepalived]# ls

keepalived.conf  samples

[root@server1 keepalived]# vim keepalived.conf 

heartbeat+ipvs+keepalived

heartbeat+ipvs+keepalived

heartbeat+ipvs+keepalived

[root@server1 keepalived]# /etc/init.d/keepalived start

將修改的配置文件發送到server4同位置

Server4上的操作

[root@server4 keepalived]#

 ln -s /usr/local/keepalived/sbin/keepalived /sbin/

[root@server4 keepalived]#

 ln -s /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d

[root@server4 keepalived]#

 chmod +x /usr/local/keepalived/etc/rc.d/init.d/keepalived

[root@server4 keepalived]#

 ln -s /usr/local/keepalived/etc/sysconfig/keepalived /

etc/sysconfig/

[root@server4 keepalived]# /etc/init.d/keepalived start

[root@server4 keepalived]# mkdir /etc/keepalived/

將文件中的server1改為server4state改為backup

兩者的virtual_router_id一定不同,server4priority值小于server1的值

keepalived進行重啟

測試:

heartbeat+ipvs+keepalived


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

沙湾县| 南木林县| 临漳县| 江达县| 娱乐| 大邑县| 建始县| 青冈县| 舞钢市| 武强县| 城口县| 鸡东县| 扎囊县| 长丰县| 雷波县| 盘山县| 天峨县| 哈尔滨市| 林芝县| 互助| 中牟县| 谢通门县| 原平市| 鄂托克前旗| 湟中县| 马鞍山市| 易门县| 车险| 永康市| 宜阳县| 固镇县| 沈阳市| 勐海县| 驻马店市| 九龙县| 崇阳县| 沂源县| 明光市| 景东| 增城市| 阿荣旗|