【高可用HA】Apache (2) —— Mac下安装多个Apache Tomcat实例
Mac 下安装多个Apache Tomcat实例
tomcat版本:tomcat-8.0.29
参考来源:
Installing Tomcat 7.0.x on OS X
安装
官网下载Tomcat
这里选择的是"apache-tomcat-8.0.29"读者可以自行选择。
将“apache-tomcat-8.0.29.zip”解压到自定义目录"./servers/cluster/tomcat/"下,并复制出两个备份"./tomcat/node-a"和"./tomcat/node-b"
配置
-
node-a
修改"./tomcat/node-a"的server.xml配置文件,注意有三个地方都需要修改
-
默认Server Port
<Server port="8005" shutdown="SHUTDOWN">
修改成
<Server port="8015" shutdown="SHUTDOWN">
-
默认Connector
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
修改成
<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
-
默认AJP
<!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
修改成
<!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8019" protocol="AJP/1.3" redirectPort="8443" />
-
默认Tomcat首页
"./servers/cluster/tomcat/node-a/webapps/ROOT/index.jsp"
将主题信息修改成:
<div id="congrats" class="curved container"> <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations! Node - A!!</h2> </div>
同理对于
-
node-b
分别修改Server/Connector/AJP对应的端口依次为 8025|8082|8029
-
默认Tomcat首页,将主题信息修改成:
<div id="congrats" class="curved container"> <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations! Node - B!!</h2> </div>
测试
通过浏览器分别访问
http://localhost:8081/
http://localhost:8082/