配置环境:
节点1:server1(172.25.62.1)
节点2:server2(172.25.62.4)
real server1(172.25.62.2)
real server2(172.25.62.3)
一、RS配置:
下载httpd服务,并修改默认发布录文件,打开httpd服务
二、nginx配置
server1和server4配置ngnix服务,配置方法在:
https://blog.csdn.net/weixin_41789003/article/details/80836187
为了在luci管理器上用执行脚本执行,所以需要编辑nginx的执行脚本
vim nginx
#!/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 $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest_q || return 6
stop
start
}
reload() {
configtest_q || return 6
echo -n $"Reloading $prog: "
killproc -p $pidfile $prog -HUP
echo
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
configtest_q() {
$nginx -t -q -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
# Upgrade the binary with no downtime.
upgrade() {
local oldbin_pidfile="${pidfile}.oldbin"
configtest_q || return 6
echo -n $"Upgrading $prog: "
killproc -p $pidfile $prog -USR2
retval=$?
sleep 1
if [[ -f ${oldbin_pidfile} && -f ${pidfile} ]]; then
killproc -p $oldbin_pidfile $prog -QUIT
success $"$prog online upgrade"
echo
return 0
else
failure $"$prog online upgrade"
echo
return 1
fi
}
# Tell nginx to reopen logs
reopen_logs() {
configtest_q || return 6
echo -n $"Reopening $prog logs: "
killproc -p $pidfile $prog -USR1
retval=$?
echo
return $retval
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest|reopen_logs)
$1
;;
force-reload|upgrade)
rh_status_q || exit 7
upgrade
;;
reload)
rh_status_q || exit 7
$1
;;
status|status_q)
rh_$1
;;
condrestart|try-restart)
rh_status_q || exit 7
restart
;;
*)
echo $"Usage: $0 {start|stop|reload|configtest|status|force-reload|upgrade|restart|reopen_logs}"
exit 2
esac
server1和server4都需要操作
复制到/etc/init.c/下并给到执行权限
3、ricci节点配置
在server1和server4安装ricci服务
并将服务打开,开启开机自启动
4、luci管理节点设置
将管理节点设置在server1上
yum install luci -y
打开luci服务
5、在luci的web页面配置
luciweb页面配置详情:
https://blog.csdn.net/weixin_41789003/article/details/80809365
将之前的httpd服务删除,或者停掉
在luci节点管理工具查看
[root@server1 init.d]# clustat
Cluster Status for westos_hwj @ Thu Jun 28 10:40:27 2018
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
server1 1 Online, Local, rgmanager
server4 2 Online, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:web server1 started
当server1的nginx停掉之后,
[root@server1 init.d]# clustat
Cluster Status for westos_hwj @ Thu Jun 28 11:32:58 2018
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
server1 1 Online, Local, rgmanager
server4 2 Online, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:web server4 starting
且vip自动被4接管
[root@server4 init.d]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:63:92:32 brd ff:ff:ff:ff:ff:ff
inet 172.25.62.4/24 brd 172.25.62.255 scope global eth0
inet 172.25.62.100/24 scope global secondary eth0
inet6 fe80::5054:ff:fe63:9232/64 scope link
valid_lft forever preferred_lft forever