session服务器配置Redis
1.配置各个机器的主机名
hostname nginx
bash
hostname done1
bash
hostname done2
bash
2.配置主机名与IP映射
vim /etc/hosts
192.168.200.111 nginx
192.168.200.112 done1
192.168.200.113 done2
3.关闭防火墙和selinux
systemctl stop firewalld
iptables -F
setenforce 0
4.修改tomcat两个文件
第一个文件
vim /usr/local/tomcat8/conf/server.xml
修改项:128行添加
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1">
134行去掉注释
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
去掉注释
第二个文件
vim /usr/local/tomcat8/webapps/ROOT/WEB-INF/web.xml
倒数第二行添加
<distributable/>
5.启动服务
/usr/local/tomcat8/bin/shutdown.sh && /usr/local/tomcat8/bin/startup.sh
6.添加组播地址
route add -net 224.0.0.0 netmask 240.0.0.0 dev eno16777728
7.查看端口
netstat -lnpt | grep -E ”8080|4000”
8.建立session.jsp测试页面
vim /usr/local/tomcat8/webapps/ROOT/session.jsp
添加内容
Session ID:<%= session.getId() %><BR>
SessionPort:<%= request.getServerPort() %>
<% out.println("This tomcat server 192.168.200.112");%>
9.重启服务
/usr/local/tomcat8/bin/shutdown.sh && /usr/local/tomcat8/bin/startup.sh
10.输入网址进行测试