一、初始RHCS
RHCS(Red Hat Cluster Suite,红帽集群套件)是Red Hat公司开发整合的一套综合集群软件组件,提供了集群系统中三种集群构架,分别是高可用性集群、负载均衡集群、存储集群,可以通过在部署时采用不同的配置,以满足你的对高可用性、负载均衡、可扩展性、文件共享和节约成本的需要。
二、实验环境的说明
server1 172.25.7.1(配置Nginx、ricci和luci)
server2 172.25.7.2(Apache)
server3 172.25.7.3(Apache)
server4 172.25.7.4(配置Nginx、ricci)
Server1和server4配置高可用yum源(不予演示)
三、Nginx的部署
[root@server1 ~]# tar zxf /mnt/nginx-1.10.1.tar.gz
[root@server1 ~]# vim /mnt/nginx-1.10.0/src/core/nginx.h #关闭版本显示
12 #define nginx_version 1010001
13 #define NGINX_VERSION "1.10.1"
14 #define NGINX_VER "nginx"
[root@server1 ~]# vim /mnt/nginx-1.10.0/auto/cc/gcc #关闭调试环境
# debug
#CFLAGS="$CFLAGS -g"
[root@server1 ~]#yum install -y pcre-devel gcc openssl-devel
[root@server1 ~]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module -with-threads --with-file-aio
[root@server1 ~]# make && make install
[root@server1 ~]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
[root@server1 ~]# useradd -M -d /usr/local/nginx/ nginx
编辑nginx配置文件实现负载均衡
[root@server1 conf]# vim nginx.conf
upstream westos{
server 172.25.7.2:80;
server 172.25.7.3:80;
}
server {
listen 80;
server_name www.westos.org;
location / {
proxy_pass http://westos;
}
}
编写一个nginx启动脚本,放在/etc/init.d/中:
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
lockfile="/var/lock/subsys/nginx"
pidfile="/usr/local/nginx/logs/${prog}.pid"
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $