下载apache-tomcat-8.5.34.tar.gz
并解压,tar -zxvf apache-tomcat-8.5.34.tar.gz
复制解压后的tomcat到安装目录,cp -r apache-tomcat-8.5.34 /opt/tomcat/tomcat8-geo3
/etc/systemd/system/
下新建service文件,tomcat8-geo3.service文件来管理Tomcat 进程
内容如下:
[Unit]
Description=Tomcat8-geo3
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
Environment="JAVA_HOME=/usr/java/jdk1.8.0_181" "JRE_HOME=/usr/java/jdk1.8.0_181/jre"
PIDFile=/home/arcgis/tomcat/tomcat8-geo3/tomcat.pid
Environment=CATALINA_PID=/home/arcgis/tomcat/tomcat8-geo3/tomcat.pid
Environment=CATALINA_HOME=/home/arcgis/tomcat/tomcat8-geo3
Environment=CATALINA_BASE=/home/arcgis/tomcat/tomcat8-geo3
ExecStart=/home/arcgis/tomcat/tomcat8-geo3/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
保存文件,刷新配置,让systemctl能识别
sudo systemctl daemon-reload
修改端口号
lsof -i:8085
查看端口是否被占用
开启端口
ufw allow 8085
启动tomcat,并查看tomcat状态:
systemctl start tomcat8-geo3
systemctl status tomcat8-geo3
允许开机自动启动:
sudo systemctl enable tomcat8-geo3
JAVA_OPTS="-server -XX:PermSize=512M -XX:MaxPermSize=1024m -Xms1024M -Xmx1024M -XX:MaxNewSize=256m"
JAVA_OPTS="$JAVA_OPTS -DCLUSTER_CONFIG_DIR=/DataDisk/iserver/iserver_data_dir/cluster/clusterConfig3"
geoserver-2.16.0
geoserver-2.16-SNAPSHOT-jms-cluster-plugin
geoserver-2.16-SNAPSHOT-activeMQ-broker-plugin
#
#Wed Mar 25 15:13:04 CST 2020
toggleSlave=true
topicName=VirtualTopic.geoserver
connection=enabled
brokerURL=tcp\://127.0.0.1\:61616
durable=true
xbeanURL=./broker.xml
toggleMaster=true
embeddedBroker=enabled
CLUSTER_CONFIG_DIR=/DataDisk/iserver/iserver_data_dir/cluster/clusterConfig3
embeddedBrokerProperties=embedded-broker.properties
connection.retry=10
instanceName=6bd9d6b2-1993-4020-ab91-02054e120040
readOnly=disabled
group=geoserver-cluster
connection.maxwait=10000
## JMX settings (can be overridden by env vars)
## For more information, see: http://activemq.apache.org/jmx.html
# enable/disable broker jmx
activemq.jmx.useJmx=false
# set the JMX connector port
activemq.jmx.port=1098
# set the JMX connector host
activemq.jmx.host=localhost
# enable the JMX connector
activemq.jmx.createConnector=false
## broker settings
# set the base path of the temporary broker dir
# this is also used as persistence base dir
#activemq.base=./
## configuring the embedded broker
# connects the server via native I/O socket to the local network broadcast using an automatic assigned port
# maximumConnections and wireFormat.maxFrameSize are added to avoid ddos attacks
activemq.transportConnectors.server.uri=nio://127.0.0.1:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600&jms.useAsyncSend=true&transport.daemon=true&trace=true
## the broker performs discovery using the following protocol:
# multicast on default network
activemq.transportConnectors.server.discoveryURI=multicast://224.1.1.3:6255
## persistence settings and system usage
## The systemUsage controls the maximum amount of space the broker will
## use before slowing down producers.
## For more information, see: http://activemq.apache.org/producer-flow-control.html
# enable/disable persistence
activemq.broker.persistent=true
# heap memory usage
activemq.broker.systemUsage.memoryUsage=128 mb
# disk space memory usage
activemq.broker.systemUsage.storeUsage=1 gb
# temp disk space memory usage
activemq.broker.systemUsage.tempUsage=128 mb
embedded-broker.properties
activemq.transportConnectors.server.uri=nio://127.0.0.1:61616......
的端口要不同于已存在的节点设置的端口,即如果已经有了61616就应该设置其他不用于61616的端口# geoserver 集群端口
upstream geoserverCluster {
ip_hash; # 支持session
server localhost:8083;
server localhost:8084;
server localhost:8085;
}
server {
listen 80;
server_name localhost;
# 用于访问geoserver
location ^~ /geoserver/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:$server_port;
proxy_pass http://geoserverCluster/geoserver/;
}
}
nginx -t
检查nginx配置脚本是否有错
nginx -s reload
重新加载脚本