符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
centos7系统中如何安装配置keepalived?相信大部分人都还没学会这个技能,为了让大家学会,给大家总结了以下内容,话不多说,一起往下看吧。
创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于网站设计、成都网站设计、荥经网络推广、成都微信小程序、荥经网络营销、荥经企业策划、荥经品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联公司为所有大学生创业者提供荥经建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com
系统版本 | nginx版本 | keepalived版本 | ip | 作用 |
---|---|---|---|---|
CentOS Linux release 7.5.1804 (Core) | nginx/1.16.1 | keepalived-2.0.18 | 10.1.1.31 | master |
CentOS Linux release 7.5.1804 (Core) | nginx/1.16.1 | keepalived-2.0.18 | 10.1.1.32 | slave |
VIP 10.1.1.111
安裝nignx
yum install nginx -y
修改nginx配置文件
master
echo 'this is master 31' > /usr/share/nginx/html/index.html
slave
echo 'this is slave 32' > /usr/share/nginx/html/index.html
启动nginx
systemctl start nginx
测试nginx启动
curl localhost
this is master
yum -y install openssl-devel gcc gcc-c++
mkdir /etc/keepalived
wget https://www.keepalived.org/software/keepalived-2.0.18.tar.gz
tar -zxvf keepalived-2.0.18.tar.gz
mv keepalived-2.0.18 /usr/local/keepalived
cd /usr/local/keepalived
./configure && make && make install
cp -a /usr/local/etc/keepalived /etc/init.d/
cp -a /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
cp -a /usr/local/sbin/keepalived /usr/sbin/
master
cat > /etc/keepalived/keepalived.conf << EOF
! Configuration File for keepalived
global_defs {
router_id 31
}
vrrp_instance VI_1 {
state MASTER
interface ens33
virtual_router_id 3
mcast_src_ip 10.1.1.132
priority 200
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
virtual_ipaddress {
10.1.1.111/24
}
}
EOF
slave
cat > /etc/keepalived/keepalived.conf << EOF
! Configuration File for keepalived
global_defs {
router_id 32
}
vrrp_instance VI_1 {
state BACKUP
interface ens33
virtual_router_id 3
mcast_src_ip 10.1.1.132
priority 90
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
virtual_ipaddress {
10.1.1.111/24
}
}
EOF
systemctl start keepalived
systemctl enable keepalived
master
$ curl localhost
this is master
root@centos7[14:46:07]:~
$ curl 10.1.1.111
this is master
root@centos7[15:03:29]:~
slave
$ curl localhost
this is slave
root@centos7[15:03:59]:/etc/keepalived
$ curl 10.1.1.111
this is master
master关闭keepalived
$ systemctl stop keepalived
$ curl localhost
this is slave
root@centos7[15:10:29]:/etc/keepalived
$ curl 10.1.1.111
this is slave
keepalived完成
关于centos7安装配置keepalived的教程就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。