Tomcat多个实例部署实践

背景:昨天新够了一台2G内存的主机,所以我折腾折腾多应用

所以整合了多个节点;

[dzapp@VM_137_106_centos app]$ ls -ltr
total 8
drwxrwxr-x 8 dzapp dzapp 4096 May  3 17:03 app1
drwxrwxr-x 8 dzapp dzapp 4096 May  3 17:31 app2
[dzapp@VM_137_106_centos app]$ 

分别为节点1,节点2;

下面以节点1为例构建:

[dzapp@VM_137_106_centos tomcat]$ pwd
/home/dzapp/bin/tomcat
[dzapp@VM_137_106_centos tomcat]$ ls -ltr
total 124
-rw-r--r-- 1 dzapp dzapp  6881 May  3 16:35 RELEASE-NOTES
drwxr-xr-x 2 dzapp dzapp  4096 May  3 16:35 work
drwxr-xr-x 2 dzapp dzapp  4096 May  3 16:35 logs
drwxr-xr-x 2 dzapp dzapp  4096 May  3 16:35 lib
drwxr-xr-x 2 dzapp dzapp  4096 May  3 16:35 temp
drwxr-xr-x 2 dzapp dzapp  4096 May  3 16:35 conf
-rw-r--r-- 1 dzapp dzapp 16416 May  3 16:35 RUNNING.txt
-rw-r--r-- 1 dzapp dzapp  1859 May  3 16:35 NOTICE
-rw-r--r-- 1 dzapp dzapp 58153 May  3 16:35 LICENSE
drwxr-xr-x 5 dzapp dzapp  4096 May  3 16:36 webapps
drwxr-xr-x 3 dzapp dzapp  4096 May  3 17:47 bin
[dzapp@VM_137_106_centos tomcat]$ 

上面是构建的tomcat 容器;

cp ../../bin/tomcat/work/ work
cp ../../bin/tomcat/conf/ conf
cp ../../bin/tomcat/logs/ logs
cp ../../bin/tomcat/temp/ temp
cp ../../bin/tomcat/webapps/ webapps

   ├── conf
 │ ├── logs
 │ ├── target
 │ ├── temp
 │ ├── webapp
 │ └── work



 

拷贝结构如上:

修改conf->server.xml 端口修改:8080->18080 ;8443->18443等等

增加bin目录,构建start.sh,stop.sh

[dzapp@VM_137_106_centos bin]$ more start.sh 


export CATALINA_HOME="/home/dzapp/bin/tomcat"
export CATALINA_BASE="/home/dzapp/app/app1"
export JVM_OPTIONS="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m"
cd $CATALINA_HOME/bin
./startup.sh
[dzapp@VM_137_106_centos bin]$ more stop.sh


export CATALINA_HOME="/home/dzapp/bin/tomcat"
export CATALINA_BASE="/home/dzapp/app/app1"
export JVM_OPTIONS="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m"
cd $CATALINA_HOME/bin
./shutdown.sh
[dzapp@VM_137_106_centos bin]$ 

 

构建完了第一个节点;

第二个节点类似,区别端口要修改成不一样;目录不一样;

 

大功告成!

 

下次写个shell 一键构建。

除特别注明外,本站所有文章均为duzhi原创,转载请注明出处来自https://www.duzhi.me/article/4205.html

联系我们

******

在线咨询:点击这里给我发消息

邮件:ashang.peng#aliyun.com

QR code