centos7上keepalived的安裝和配置
1、環境規劃
1)master:node1,centos7.5,eth0:192.168.1.11,eht1:10.10.1.11,keepalive
2)backup:node1,centos7.5,eth0:192.168.1.12,eth1:10.10.1.12,keepalive
2、搭建步驟
1)node1,node2上都以mini方式安裝CentOS 7.5 64-bit,並按照規劃配置IP地址;
2)node1,node2的/etc/hosts中新增如下內容。
192.168.1.11 node1.xx.xxx.com node1
10.10.1.11 node1.xx.xxx.com node1
192.168.1.12 node2.xx.xxx.com node2
10.10.1.12 node2.xx.xxx.com node2
3)node1,node2安裝keepalive1.3.5
#yum install keeplived
4)配置node1上的keepalive
vi /etc/keepalived/keepalived.conf #進行如下修改
vrrp_instance VI_1 {
state MASTER #設定節點node1為MASTER角色
interface enp11s0f0 #配置eth0網路卡enp11s0f0為節點node1的系統IP
virtual_router_id 51 #master和backup一致
priority 100 #數字越大,等級越高,保證master比任何backup高
advert_int 1
authentication {
auth_type PASS #vrrp協議,保證master及其他backup一致
auth_pass 1111 #保證master及其他backup一致
}
virtual_ipaddress {
192.168.1.210/24 #VIP
}
5)配置節點node2上的keeplive
vi /etc/keepalived/keepalived.conf #進行如下修改
vrrp_instance VI_1 {
state BACKUP #設定節點node2為BACKUP角色
interface enp11s0f0 #配置eth0網路卡enp11s0f0為節點node2的系統IP
virtual_router_id 51 #master和backup一致
priority 99 #數字越大,等級越高,保證比master低
advert_int 1
authentication {
auth_type PASS #vrrp協議,保證master及其他backup一致
auth_pass 1111 #保證master及其他backup一致
}
virtual_ipaddress {
192.168.1.210/24 #VIP
}
6)啟動和配置keepalive
systemctl start keepalived.service
systemct enable keepalived.service
3、驗證
1)檢視master上keepalive及ip
ps -ef|grep keepalive
ip addr
2)keepalived高可用測試
#關閉node1上的keepalived
systemctl stop keepalived.service
#檢視node1上的keepalived和ip
ps -ef|grep keepalived
ip addr
#檢視node2上的keepalived和ip
ps -ef|grep keepalived
ip addr
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8484829/viewspace-2674280/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS7 下 Nginx 的安裝和配置CentOSNginx
- CentOS7上安裝和使用DockerCentOSDocker
- CentOS7上安裝並配置Nginx、PHP、MySqlCentOSNginxPHPMySql
- Linux上的redis的安裝和配置LinuxRedis
- keepalived安裝
- CentOS7 安裝配置 GitLabCentOSGitlab
- Centos7上安裝dockerCentOSDocker
- keepalived 安裝部署
- centos7上 IC工具的安裝CentOS
- RHEL7/CentOS7線上和離線安裝GitLab配置使用實踐CentOSGitlab
- Centos7安裝配置Hive教程。CentOSHive
- CentOS7 sudo 安裝與配置CentOS
- centos7下cobbler安裝配置CentOS
- CentOS7 安裝 配置網路CentOS
- CentOS7安裝完之後的配置CentOS
- git安裝及配置教程 windows windows上git的安裝和使用GitWindows
- centos7 (阿里雲、linux) 單機spark的安裝與配置詳解(jdk安裝與配置,scala安裝與配置,hadoop安裝與配置,spark安裝與配置)CentOS阿里LinuxSparkJDKHadoop
- vmware 線上安裝 CentOS7CentOS
- 在Centos7上安裝DockerCentOSDocker
- Centos7下安裝配置elasticsearch 6.3.1CentOSElasticsearch
- 在CentOS 7.5上安裝和配置ProFTPDCentOSFTP
- Centos7下安裝配置MySQL5.7CentOSMySql
- CentOS7安裝Docker並配置映象加速CentOSDocker
- centos7 hadoop 單機模式安裝配置CentOSHadoop模式
- CentOS7下RabbitMQ服務安裝配置CentOSMQ
- Barrier 的安裝和配置
- Flutter的安裝和配置Flutter
- windows和CentOS7安裝wkhtmltopdfWindowsCentOSHTML
- 在centos7上安裝mysql5.7CentOSMySql
- 在Centos7上安裝Redis6CentOSRedis
- Centos7上安裝、破解bamboo6.0.3CentOS
- windows上安裝配置redisWindowsRedis
- Centos7安裝與配置OpenVPN伺服器CentOS伺服器
- centos7 安裝 ElasticSearch 配置外網訪問CentOSElasticsearch
- CentOS7下RabbitMQ3.7安裝與配置CentOSMQ
- centos7 解除安裝和重新安裝yumCentOS
- clickhouse for centos7安裝和使用初探CentOS
- Ubuntu 下安裝 keepalived 和 Nginx負載均衡 轉發UbuntuNginx負載