keepalived nginx安裝
把keepalived-1.2.23.tar.gz傳送到/opt下
cd /opt/
tar -zxvf keepalived-1.2.23.tar.gz
cd keepalived-1.2.23
./configure --prefix=/usr/local/keepalived
make && make install
cd /etc
mkdir keepalived
cd /usr/local/keepalived/etc/keepalived
cp keepalived.conf /etc/keepalived/
複製keepalived專用內的檔案
cd /usr/local/keepalived/etc/rc.d/init.d/
cp keepalived /etc/init.d/
cp keepalived.conf /etc/sysconfig/
cp keepalived /etc/sysconfig/
vim /etc/keepalived/keepalived.conf
主keepalived 配置master ,備配置backup
vim /etc/init.d/keepalived
path="$path:/usr/local/keepalived/sbin"
export path
為keepalived的路徑
service keepalived start
service keepalived status
把tengine-2.1.2.tar.gz複製到/opt
yum -y install openssl openssl-devel pcre pcre-devel
cd /opt
tar -zxvf tengine-2.1.2.tar.gz
cd tengine-2.1.2
./configure --prefix=/usr/local/nginx
make && make install
cd /etc
mkdir nginx
cd /usr/local/nginx/
cp -r conf /etc/nginx/
把nginx專用內的檔案傳送到
測試keepalived 重啟服務ip能否自動飄
關閉nginx 關閉,是否自動開啟。
#-----------------nginx發布靜態檔案-------------
location /
location /ejyhbr8iao.txt
示例:
location /ww_verify_ipbzzjdkyw0tkq7m.txt
把txt檔案上傳到指定目錄,完美解決。 keepalived nginx主從切換
五 nginx指令碼,新建nginx check.sh指令碼放到 etc keepalived下 指令碼內容 bin bash a ps c nginx no header wc l if a eq 0 then usr local nginx sbin nginx sleep 2 if ps c ...
keepalived nginx集群部署
192.168.132.130 伺服器1 192.168.132.132 伺服器2 虛擬ip 192.168.132.131 yum install gcc c gcc是gnu的c語言編譯器,至於c 編譯器,它的名字叫做g yum install y pcre pcre devel 在nginx編譯...
keepalived nginx負載安裝
環境 centos7.6 keepalived工具可以生成虛擬浮動ip,繫結到網絡卡上。172.21.210.19 master 172.21.210.20 backup 172.21.210.30 vip 浮動ip 1 兩個節點安裝keepalived yum y install keepaliv...