实现Nginx负载均衡与Keelived高可用

基本架构:

服务器(主) 192.168.32.144 nginx npre
服务器(备) 192.168.32.145 nginx npre
web1 192.168.32.146 httpd
web2 192.168.32.147 httpd

服务器部署:
安装pcre

wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
tar zxvf pcre-8.35.tar.gz 
cd pcre-8.35
./configure 
make 
make install

安装nginx

mkdir -p /usr/local/nginx
useradd nginx -s /sbin/nologin -M   
chown -R nginx:nginx /usr/local/nginx
wget http://nginx.org/download/nginx-1.14.0.tar.gz
tar zxvf nginx-1.14.0.tar.gz 
cd nginx-1.14.0
./configure  --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

启动nginx启动 停止
nginx -s stop/start/restart

客户机部署:
安装httpd

yum install httpd #安装httpd服务
systemctl restart httpd #重启httpd服务
echo “web test” >/var/www/html/index.html 
curl 127.0.0.1

LVS cluster nodes healthchecks 功能:
1. Keepalived.conf配置实现LVS功能
2.keepalived可以对LVS下的集群节点做健康检查
实现原理:利用VRRP协议实现。
主节点Director节点会不断的向备节点广播心跳消息。当主节点
VRRP(Virtual Router Redundancy Protocol) 虚拟路由器冗余协议,实现解决静态路由的单点故障

猜你喜欢

转载自blog.csdn.net/sinat_34789167/article/details/80629494
今日推荐