Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install and configure keepalived in centos7

Shulou Source: shulou.com Published: 2022-06-03 04:33:19 09月22日 Update

How to install and configure keepalived in centos7 system? I believe that most people have not yet learned this skill, in order to let you learn, to give you a summary of the following content, do not say much, let's move on.

1. Basic environment system version nginx version keepalived version ip function CentOS Linux release 7.5.1804 (Core) nginx/1.16.1keepalived-2.0.1810.1.1.31masterCentOS Linux release 7.5.1804 (Core) nginx/1.16.1keepalived-2.0.1810.1.1.32slave

VIP 10.1.1.111

II. Install nginx

Install nignx

Yum install nginx-y

Modify nginx configuration file

Master

Echo 'this is master 31' > / usr/share/nginx/html/index.html

Slave

Echo 'this is slave 32' > / usr/share/nginx/html/index.html

Start nginx

Systemctl start nginx

Test nginx startup

Curl localhostthis is master III. Install keepalived1, create a dependent environment yum-y install openssl-devel gcc gcc-c++mkdir / etc/keepalivedwget https://www.keepalived.org/software/keepalived-2.0.18.tar.gz2, install keepalivedtar-zxvf keepalived-2.0.18.tar.gzmv keepalived-2.0.18 / usr/local/keepalivedcd / usr/local/keepalived./configure & & make & & make install3, Create startup file 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/4, create configuration file

Master

Cat > / etc/keepalived/keepalived.conf / etc/keepalived/keepalived.conf

Tags: Configuration testing files versions content more environment system good function basics most skills tutorials articles servers see knowledge help services Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS Microsoft Xiaomi vpn