一、配置nginx
ps:server1和server4配置相同
server2和server3都安装httpd并打开,并在默认发布文件中加以区分
1.配置server1和server4
具体步骤请点击这里
[root@server1 ~]# tar zxf nginx-1.14.0.tar.gz
[root@server1 ~]# ls
nginx-1.14.0 nginx-1.14.0.tar.gz
[root@server1 ~]# cd nginx-1.14.0
[root@server1 nginx-1.14.0]# vim auto/cc/gcc ##注释debug
[root@server1 nginx-1.14.0]# vim src/core/nginx.h ##删除版本信息
[root@server1 nginx-1.14.0]# yum install -y gcc
[root@server1 nginx-1.14.0]# yum install -y pcre-devel
[root@server1 nginx-1.14.0]# yum install -y openssl-devel ##解决依赖性
[root@server1 nginx-1.14.0]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-threads --with-file-aio ##编译
[root@server1 nginx-1.14.0]# make && make install ##安装
[root@server1 nginx-1.14.0]# ln -s /usr/local/nginx/sbin/nginx /sbin/ ##软连接
实现负载均衡:
[root@server1 conf]# useradd -M -d /usr/local/nginx/ nginx
[root@server1 nginx-1.14.0]# nginx
[root@server1 nginx-1.14.0]# vim /usr/local/nginx/conf/nginx.conf
2 user nginx nginx;
3 worker_processes 1;
18 upstream westos{
19 server 172.25.129.2:80;
20 server 172.25.129.3:80;
21 }
123 server { ##server部分写到最后,中间内容不变
124 listen 80;
125 server_name www.westos.org;
126 location / {
127 proxy_pass http://westos;
128 }
129
130 }
[root@server1 nginx-1.14.0]# vim /usr/local/nginx/conf/nginx.conf
[root@server1 nginx-1.14.0]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@server1 nginx-1.14.0]# nginx -s reload
二、高可用(HA)的实现
注意:
(1) 红帽高可用性附加组件最多支持的集群节点数为16
(2) 使用luci配置GUI
(3) 该组件不支持在集群节点上使用NetworkManager.如果已安装NetworkManager,应该删除该程序,且selinux和iptables都为关闭装状态
(4) 集群中的节点使用多播地址彼此沟通.因此必须将红帽高可用附加组件中的每个网络切换以及关联的联网设备配置为启用多播地址并支持IGMP(互联网管理协议)