Nginx
负载均衡
首先在 server1 上编辑 Nginx 主配置文件,在 upstream 块中定义后端服务器池,分别指定 server2、server3 和 server4(只有当所有的后端server全部失效才会被启用) 的 IP 地址。轮询(round-robin)是默认的调度算法,请求会依次分配给每一台后端服务器。
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf



为了让域名 www.example.com 能够解析到 server1 的 IP,需要在 server1 本地配置 hosts 解析记录。这样在测试时可以直接通过域名访问负载均衡入口。
[root@server1 ~]# vim /etc/hosts

配置完成后,多次访问 www.example.com 会发现请求在 server2、server3 之间轮询调度。
接下来模拟服务器故障场景:手动停止 server2 上的 httpd 服务,验证 Nginx 的健康检查机制是否能自动将请求切换到其他正常节点。
[root@server2 ~]# systemctl stop httpd
同样停止 server3 上的 httpd 服务,此时三台后端服务器中只剩 server4 可用。如果配置正确,所有请求应该都会被转发到 server4。
[root@server3 ~]# systemctl stop httpd
在 server2 和 server3 都已下线的情况下,再次访问 www.example.com 进行验证。
此时访问

设置cookie
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

修改完后检查语法后reload

修改Windows中的hosts文件(需要管理员权限)
C:\Windows\System32\drivers\etc


不同浏览器访问 F12打开开发者选项


模块编译
nginx 1.30.x 版本自带sticky功能
[root@server4 ~]# wget https://nginx.org/download/nginx-1.28.3.tar.gz //下载老版本
[root@server4 ~]# tar zxf nginx-1.28.3.tar.gz
[root@server4 ~]# git clone https://github.com/fabianofurtado/nginx_sticky_module_ng.git
[root@server4 ~]# cd nginx-1.28.3/
静态编译,模块与nginx主程序编译到一起,极致性能
[root@server4 nginx-1.28.3]# ./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx_sticky_module_ng
[root@server4 nginx-1.28.3]# make && make install
动态编译,nginx主程序与模块分开编译,适合经常需要扩展模块的场景
[root@server4 nginx-1.28.3]# make clean
[root@server4 nginx-1.28.3]# vim auto/cc/gcc
关闭debug模式

[root@server4 nginx-1.28.3]# ./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_stub_status_module --with-compat --add-dynamic-module=../nginx_sticky_module_ng
[root@server4 nginx-1.28.3]# make
[root@server4 nginx-1.28.3]# cd objs
[root@server4 objs]# cp -f nginx /opt/nginx/sbin/nginx
[root@server4 objs]# mkdir /opt/nginx/modules
[root@server4 objs]# cp ngx_http_sticky_module.so /opt/nginx/modules/
在主配置文件中加载模块
[root@server4 ~]# vim /opt/nginx/conf/nginx.conf
load_module modules/ngx_http_sticky_module.so;


安全控制
限制并发连接数
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t
[root@server1 ~]# nginx -s reload
[root@server1 ~]# mkdir /usr/local/nginx/html/download
[root@server1 ~]# cd /usr/local/nginx/html/download //在这里面上传一张图
必须单线程下载,超出的并发连接会失败
[root@server4 ~]# ab -c 10 -n 10 http://192.168.247.129/download/vim.jpg
[root@server1 ~]# tail -f /usr/local/nginx/logs/access.log

[root@server4 ~]# ab -c 1 -n 10 http://192.168.247.129/download/vim.jpg
[root@server1 nginx]# tail -f /usr/local/nginx/logs/access.log

限制请求数
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t
[root@server1 ~]# nginx -s reload
测试
超出的请求数会失败
[root@server4 ~]# ab -c 1 -n 10 http://192.168.247.129/download/vim.jpg

限制速率

[root@server1 ~]# nginx -s reload
测试
[root@server4 ~]# ab -c 1 -n 5 http://192.168.247.129/download/vim.jpg

自动索引
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t
[root@server1 ~]# nginx -s reload

缓存配置
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf
location ~ .*\.(gif|jpg|png)$ {
expires 365d;
root html;
}

[root@server1 ~]# nginx -t
[root@server1 ~]# nginx -s reload

日志轮转
[root@server1 ~]# mkdir /opt/scripts
#!/bin/bash
cd /usr/local/nginx/logs && mv access.log access_$(date +%F -d -1day).log
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`

[root@server1 ~]# chmod +x /opt/scripts/nginxlog.sh
[root@server1 ~]# /opt/scripts/nginxlog.sh
[root@server1 logs]# ll /usr/local/nginx/logs

nginx日志可视化
下载软件包
[root@server1 ~]# wget https://tar.goaccess.io/goaccess-1.8.tar.gz
[root@server1 ~]# tar xf goaccess-1.8.tar.gz
[root@server1 ~]# cd goaccess-1.8/
[root@server1 goaccess-1.8]# yum install -y ncurses-devel GeoIP-devel
[root@server1 goaccess-1.8]# yum install -y epel-release
[root@server1 goaccess-1.8]# yum install -y libmaxminddb-devel glib2-devel ncurses-devel zlib-devel
root@server1 goaccess-1.8]# ./configure --enable-utf8 --enable-geoip=mmdb
[root@server1 goaccess-1.8]# make && make install
启动
[root@server1 ~]# goaccess /usr/local/nginx/logs/access.log -o /usr/local/nginx/html/report.html --log-format=COMBINED --real-time-html &
访问:http://192.168.247.129/report.html

站点限制
location /status {
stub_status on; #启用监控模块
access_log off; #禁用日志记录
allow 127.0.0.1; #只允许本机访问
deny all; #禁用所有主机访问
}

[root@server1 ~]# nginx -s reload


中文乱码
[root@server1 ~]# vim /usr/local/nginx/html/index.html


[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -s reload

虚拟主机

[root@server1 ~]# nginx -t
[root@server1 ~]# nginx -s reload
[root@server1 ~]# mkdir /web1
[root@server1 ~]# echo www.example.com > /web1/index.html
测试
[root@server4 ~]# vim /etc/hosts


https配置
[root@server1 ~]# cd /etc/pki/tls/certs
[root@server1 certs]# make cert.pem

[root@server1 certs]# mv cert.pem /usr/local/nginx/conf/
[root@server1 certs]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t
[root@server1 ~]# nginx -s reload
[root@server4 ~]# curl -k https://www.example.com
curl -k 作用:跳过 HTTPS 证书合法性校验

重定向
80重定向到443
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf
rewrite ^/(.*)$ https://www.example/$1 permanent;

[root@server1 ~]# nginx -t
[root@server1 ~]# nginx -s reload

www.example.com/bbs 重定向bbs.example.com
[root@server1 ~]# mkdir /bbs
[root@server1 ~]# echo bbs.example.com > /bbs/index.html
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -s reload

防盗链
配置server2上的apache服务,盗链server1上的图片
[root@server2 ~]# cd /var/www/html/
[root@server2 html]# vim index.html
<html>
<body>
<img src="http://www.example.com/vim.jpg"/>
</body>
</html>
确保 /web1目录下有vim.jpg图片

[root@server2 html]# vim /etc/hosts //配置解析

Windows电脑同理配置解析


浏览器访问server2的ip地址

接下来在server1上配置防盗链
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf
location ~ \.(jpg|png)$ {
root /web1;
valid_referers none blocked www.example.com;
if ($invalid_referer) {
#return 403;
rewrite ^/ http://bbs.example.com/daolian.jpg;
}
}

[root@server1 ~]# nginx -s reload
修改Windows电脑上的配置解析和确保 server1上的/bbs目录下有daolian.jpg

输入server2的ip访问

输入域名可以正常访问

php部署
php安装
[root@server1 ~]# tar xf php-8.3.32.tar.gz
[root@server1 ~]# cd php-8.3.32/
将源码包解压后进入其根目录,这里会看到 configure 脚本、ext/ 扩展目录以及 sapi/ 等核心子目录。后续所有操作——包括依赖安装、配置检测、编译和安装——都围绕这个目录展开。configure 是源码编译的核心环节,它会自动探测当前系统的库文件、头文件位置和编译器能力,生成适用于本机的 Makefile。如果系统中缺少必要的开发包(通常以 -devel 结尾),configure 阶段就会直接报错并给出缺失提示,因此提前把依赖装全可以大幅减少后续排查时间。
[root@server1 ~]# yum install -y bzip2 systemd-devel libxml2-devel sqlite-devel libpng-devel libcurl-devel
如果后续 configure 仍提示缺少某些库,只需根据报错信息用 yum search 找到对应的 -devel 包安装即可。
# 1.安装epel源
yum install -y epel-release
2.安装remi仓库
yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
3.安装正则库(关键修复包)
yum install -y --enablerepo=remi oniguruma oniguruma-devel
这里通过 EPEL 和 Remi 两个第三方仓库来获取较新版本的软件包。其中 oniguruma(正则库)是整个安装链路中的关键一环——PHP 的 mbstring(多字节字符串)扩展在编译时必须依赖它来处理正则表达式匹配。CentOS 7 自带的 oniguruma 版本太旧,因此需要从 Remi 仓库安装新版 oniguruma-devel,否则 configure 阶段会直接报 oniguruma not found 错误而中断。
[root@server1 php-8.3.32]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring --enable-bcmath --with-fpm-systemd
[root@server1 php-8.3.32]# make
此时会有报错,解决方案如下:
编译报错在 PHP 源码安装中非常常见,尤其是在 CentOS 7 这样系统库版本偏旧的发行版上。常见原因包括:OpenSSL 版本过低(PHP 8.x 要求 OpenSSL 1.0.2 以上)、cmake 版本不满足 libzip 的构建要求(libzip 1.9+ 需要 cmake 3.x,而 CentOS 7 自带的是 2.8)、libzip 版本不够新(PHP 8.x 的 zip 扩展需要 libzip 1.7+)。下面的解决方案按「先升级 OpenSSL → 再升级 cmake → 最后升级 libzip」的顺序逐一处理
卸载老版本openssl
[root@server1 ~]# yum remove -y openssl-devel
升级openssl版本
wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar -xf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config shared zlib --prefix=/usr/local/openssl
make -j$(nproc)
make install
核心环境变量
export PKG_CONFIG_PATH=/usr/local/openssl/lib/pkgconfig:$PKG_CONFIG_PATH
动态链接库注册
echo "/usr/local/openssl/lib" > /etc/ld.so.conf.d/openssl.conf
ldconfig
验证pkg-config能否识别
pkg-config --modversion openssl

升级cmake
[root@server1 ~]# wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
[root@server1 ~]# yum install -y cmake3
[root@server1 ~]# ln -s /usr/bin/cmake3 /usr/bin/cmake
升级libzip
[root@server1 ~]# wget https://libzip.org/download/libzip-1.9.2.tar.gz
[root@server1 ~]# tar -xf libzip-1.9.2.tar.gz
[root@server1 ~]# cd libzip-1.9.2
[root@server1 libzip-1.9.2]# mkdir build && cd build
[root@server1 build]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libzip -DBUILD_SHARED_LIBS=ON ..
[root@server1 build]# make -j$(nproc)
[root@server1 build]# make install
注册动态链接库
[root@server1 build]# echo "/usr/local/libzip/lib64" > /etc/ld.so.conf.d/libzip.conf
[root@server1 build]# ldconfig
设置环境变量
export PKG_CONFIG_PATH=/usr/local/libzip/lib64/pkgconfig
验证是否识别成功
pkg-config --modversion libzip

[root@server1 php-8.3.32]# yum install -y libjpeg-turbo-devel freetype-devel libpng-devel curl-devel readline-devel
[root@server1 php-8.3.32]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-cli --enable-opcache --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mbstring --enable-xml --enable-gd --with-zip=/usr/local/libzip --with-curl --with-jpeg --with-freetype --with-openssl=/usr/local/openssl --enable-bcmath --enable-soap --enable-sockets --enable-exif --with-readline --with-zlib
[root@server1 php-8.3.32]# make -j$(nproc)
[root@server1 php-8.3.32]# make install

php配置
PHP 编译安装完成后,接下来需要对其运行环境进行配置。PHP-FPM(FastCGI Process Manager)是 PHP 的 FastCGI 实现,作为独立的服务进程与 Nginx 通信处理 PHP 请求。配置工作围绕以下几个核心文件展开:php-fpm.conf(FPM 主配置)、www.conf(进程池配置)、php.ini(PHP 运行时配置)以及 php-fpm.service(systemd 服务单元文件)。下面逐一说明各文件的作用和配置要点。
首先,PHP 源码安装默认不会生成现成的配置文件,需要从源码包中复制模板文件。进入 /usr/local/php/etc 目录后,cp php-fpm.conf.default php-fpm.conf 生成 FPM 主配置文件。该文件定义了全局设置,包括错误日志路径、进程 pid 文件位置、以及通过 include 指令引入子配置文件(如 www.conf)。比如 pid = run/php-fpm.pid 指定了进程 ID 文件的存放位置,error_log = log/php-fpm.log 则用于记录 FPM 运行时的错误信息。
接下来配置 www.conf,它定义了具体的进程池(pool)。一个进程池就是一组 PHP-FPM 工作进程,负责处理来自 Nginx 的 FastCGI 请求。关键参数包括:user 和 group(指定工作进程的运行用户,通常设为 nginx)、listen(监听地址,默认 127.0.0.1:9000 或套接字文件)、pm(进程管理模式,推荐使用 dynamic)、pm.max_children(最大子进程数)等。这些参数直接影响 PHP 处理请求的并发能力和资源占用,建议根据服务器内存和业务负载合理调整。
配置完进程池后,需要设置 PHP 运行时参数。将源码包根目录下的 php.ini-production 复制到 /usr/local/php/etc/php.ini。这是 PHP 的核心配置文件,控制着错误报告级别、内存限制(memory_limit)、上传文件大小(upload_max_filesize)、POST 数据大小(post_max_size)以及扩展加载等数百个选项。php.ini-production 模板采用了适合生产环境的安全默认值(例如关闭错误显示、限制内存使用),是推荐的配置起点。如果需要开启调试,可使用 php.ini-development 模板,它会启用详细错误信息和日志记录。
最后,为了让 PHP-FPM 能够通过 systemd 进行服务管理(如开机自启、重启、状态查询),需要将 sapi/fpm/php-fpm.service 文件复制到 /usr/lib/systemd/system/ 目录。编辑该服务文件,确保 ExecStart 指向正确的 PHP-FPM 可执行文件路径,并注释或删除不必要的环境变量设置。配置完成后,使用 systemctl start php-fpm 启动服务,systemctl enable php-fpm 设置开机自启,即可让 PHP-FPM 随系统启动而自动运行。
[root@server1 php-8.3.32]# cd /usr/local/php/etc
[root@server1 etc]# cp php-fpm.conf.default php-fpm.conf
[root@server1 etc]# vim php-fpm.conf
取消注释

[root@server1 etc]# cd php-fpm.d/
[root@server1 php-fpm.d]# cp www.conf.default www.conf
拷贝主配置文件
[root@server1 php-8.3.32]# cp php.ini-production /usr/local/php/etc/php.ini
[root@server1 php-8.3.32]# vim /usr/local/php/etc/php.ini

[root@server1 php-8.3.32]# cd sapi/fpm
[root@server1 fpm]# cp php-fpm.service /usr/lib/systemd/system
[root@server1 fpm]# vim /usr/lib/systemd/system/php-fpm.service
注释红色框中内容


nginx和php整合
[root@server1 ~]# cd /usr/local/nginx/conf/
[root@server1 conf]# vim nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}

[root@server1 conf]# nginx -s reload
[root@server1 conf]# vim /usr/local/nginx/html/index.php
<?php
phpinfo()
?>
测试: http://192.168.247.129/index.php

php动态模块扩展
添加php环境变量
[root@server1 ~]# vim .bash_profile

[root@server1 ~]# source .bash_profile

模块下载
[root@server1 ~]# wget https://pecl.php.net/get/memcache-8.2.tgz
[root@server1 ~]# tar xf memcache-8.2.tgz
[root@server1 ~]# cd memcache-8.2/
[root@server1 memcache-8.2]# yum install -y autoconf

[root@server1 memcache-8.2]# ./configure
[root@server1 memcache-8.2]# make && make install

[root@server1 memcache-8.2]# php -m |grep memcache
无输出,代表 PHP 还没有加载 memcache 扩展,需要修改 php.ini
[root@server1 memcache-8.2]# cd /usr/local/php/etc
[root@server1 etc]# vim php.ini
extension=memcache #添加memcache模块
[root@server1 etc]# systemctl reload php-fpm (php-fpm 平滑重启,读取新的 php.ini 配置,加载 memcache 扩展。)

有输出,证明 memcache 扩展在 PHP CLI 模式加载完成。
部署测试页面到网站根目录
[root@server1 memcache-8.2]# cp example.php memcache.php /usr/local/nginx/html/
安装并启动 memcached 服务端
yum install -y memcached
systemctl enable --now memcached
验证 memcached 端口监听
修改 memcache.php 监控页面配置
[root@server1 memcache-8.2]# cd /usr/local/nginx/html/
[root@server1 html]# vim memcache.php

测试
访问http://192.168.247.129/example.php,多刷新几次页面

查看缓存命中状态
http://192.168.247.129/memcache.php


Nginx高效缓存
Nginx配置高速缓存
[root@server1 html]# cd /root/nginx-1.30.4
[root@server1 nginx-1.30.4]# make clean
[root@server1 nginx-1.30.4]# ./configure --with-http_ssl_module --with-http_stub_status_module --add-module=../echo-nginx-module-master --add-module=../memc-nginx-module-master --add-module=../srcache-nginx-module-master --with-cc-opt="-I/usr/local/openssl/include" --with-ld-opt="-L/usr/local/openssl/lib -Wl,-rpath=/usr/local/openssl/lib"
[root@server1 nginx-1.30.4]# make
[root@server1 nginx-1.30.4]# cd objs
[root@server1 objs]# cp nginx /usr/local/nginx/sbin/nginx

[root@server1 objs]# vim /usr/local/nginx/conf/nginx.conf
upstream memcache {
server 127.0.0.1:11211;
keepalive 512;
}
location /memc {
internal;
memc_connect_timeout 100ms;
memc_send_timeout 100ms;
memc_read_timeout 100ms;
set $memc_key $query_string;
set $memc_exptime 300;
memc_pass memcache;
}
location ~ \.php$ {
set $key $uri$args;
srcache_fetch GET /memc $key;
srcache_store PUT /memc $key;
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}


压测
[root@server2 ~]# ab -c 10 -n 5000 http://192.168.247.129/memcache.php

openresty部署
首先停止nginx服务,避免端口冲突
[root@server1 ~]# nginx -s stop
配置yum源
[root@server1 ~]# curl https://openresty.org/package/rhel/openresty.repo -o /etc/yum.repos.d/openresty.repo
[root@server1 ~]# yum install -y openresty
[root@server1 ~]# cd /usr/local/openresty/nginx/conf
[root@server1 conf]# cp /usr/local/nginx/conf/nginx.conf .
[root@server1 conf]# cp /usr/local/nginx/conf/cert.pem .
检测语法
[root@server1 conf]# /usr/local/openresty/nginx/sbin/nginx -t

启动openresty
[root@server1 conf]# /usr/local/openresty/nginx/sbin/nginx
[root@server1 ~]# cd /usr/local/nginx/html

[root@server1 html]# cp example.php memcache.php index.php /usr/local/openresty/nginx/html/
浏览器访问




Session共享
部署tomcat
[root@server2 ~]# yum install -y java-1.8.0-openjdk.x86_64
[root@server2 ~]# wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.120/bin/apache-tomcat-9.0.120.tar.gz
[root@server2 ~]# tar zxf apache-tomcat-9.0.120.tar.gz -C /usr/local/
[root@server2 ~]# cd /usr/local/
[root@server2 local]# ln -s apache-tomcat-9.0.120/ tomcat
[root@server2 local]# cd tomcat/
启动服务
[root@server2 tomcat]# bin/startup.sh

访问:http://192.168.247.130:8080/

server3上同理部署
nginx整合tomcat
[root@server1 ~]# cd /usr/local/nginx/conf
[root@server1 conf]# vim nginx.conf
upstream tomcat{
sticky cookie srv_id expires=1h;
server 192.168.247.130:8080;
server 192.168.247.132:8080;
}

location ~ \.jsp$ {
proxy_pass http://tomcat;
}

[root@server1 conf]# nginx -s reload
在server2和server3上拷贝测试页面
[root@server2 ~]# cd /usr/local/tomcat/webapps/ROOT/

测试: http://192.168.247.129/test.jsp

停止server2上的tomcat服务
[root@server2 ~]# cd /usr/local/tomcat
[root@server2 tomcat]# bin/shutdown.sh
nginx对后端tomcat具有健康检测功能,自动切到server3上的tomcat服务,但是在server2上提交的session信息全部丢失。

tomcat整合memcached

tomcat服务通过msm模块把session信息交叉存储到memcached上
[root@server2 tomcat]# yum install -y memcached
[root@server2 ~]# systemctl enable --now memcached
[root@server2 ~]# netstat -antlp|grep :11211

server3也同样进行上述操作

先下载好msm.tgz包
[root@server2 ~]# tar zxf msm.tgz

[root@server2 msm]# cp * /usr/local/tomcat/lib/
[root@server2 msm]# scp * server3:/usr/local/tomcat/lib/
[root@server2 msm]# vim /usr/local/tomcat/conf/context.xml
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.247.130:11211,n2:192.168.247.132:11211"
failoverNodes="n1" #server3上修改为n2
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
/>


重启tomcat
[root@server2 tomcat]# bin/shutdown.sh
[root@server2 msm]# cd /usr/local/tomcat
[root@server2 tomcat]# bin/startup.sh
查看日志
[root@server2 tomcat]# cat logs/catalina.out

server3上也进行同样的操作

测试
http://192.168.247.129/test.jsp

关闭server3上的tomcat服务后会自动切换到server2
[root@server3 tomcat]# bin/shutdown.sh

关闭server2上的memcached服务后,会自动切换到server3上的memcached服务
[root@server2 tomcat]# systemctl stop memcached

346



被折叠的 条评论
为什么被折叠?



