keepalived+nginx builds high availability (notes)

  1. After yum installs keepalived, configure the keepalived configuration file
  • important point
    • In the keepalived configuration files of master and backup, the network card name is the network card name of the current machine
    • The choice of VIP is an available ip, which is usually used for high availability, and there are many local area network environments, so this vip is an intranet ip on the same network segment as the two machines. If it is used in an external network environment, it does not matter whether it is in a network segment, as long as the client can access it.
  1. Stop the nginx service, start the keepalived service, and you will see that keepalived pulls the nginx service to start
  • If it fails to start, it is basically a problem with configuration files and scripts, or because the firewall and selinux are not closed.
systemctl stop firewalld 关闭firewalld
iptables -nvL
setenforce 0 临时关闭selinux
getenforce命令查看是否为Permissive
  1. The keepalived script needs to be set to 755 permissions, otherwise the experiment may fail

  2. When viewing vip, you can only use the ip add command to view it, but the ifconfig command cannot be viewed

  3. nginx installed by yum, the default index page is /usr/share/nginx/html/index.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324455130&siteId=291194637