Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing tomcat under centos7 and using systemd to realize tomcat multi-instance configuration

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "install tomcat under centos7 and use systemd to achieve tomcat multi-instance configuration method", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "install tomcat under centos7 and use systemd to achieve tomcat multi-instance configuration method"!

In this article, we share the method of installing tomcat in Centos, and then using systemd to achieve multiple instances of tomcat, which can be carefully referenced by friends who need it.

System environment: CentOS 7 x86x64

1. Install jdk

Rpm-ivh jdk-8u60-linux-x64.rpm

2. Create ordinary users

Getent group tomcat | | groupadd-r tomcat

Getent passwd tomcat | | useradd-r-d / opt-s / bin/nologin tomcat

3. Download tomcat 7

Cd / opt

Wget http://mirrors.ustc.edu.cn/apache/tomcat/tomcat-7/v7.0.64/bin/apache-tomcat-7.0.64.tar.gz

Tar zxvf apache-tomcat-7.0.64.tar.gz

Mv apache-tomcat-7.0.64 tomcat01

Chown-R tomcat:tomcat tomcat01

Tar zxvf apache-tomcat-7.0.64.tar.gz

Mv apache-tomcat-7.0.64 tomcat02

Chown-R tomcat:tomcat tomcat02

Two instances listening to port 8080 at the same time will inevitably lead to conflict, so it must be modified.

Sed-I's Universe 8080max 8081Compact g'/ opt/tomcat01/conf/server.xml

Sed-I's Universe 8005 / opt/tomcat01/conf/server.xml 8001gamma

Sed-I's Universe 8080max 8082Compact g'/ opt/tomcat02/conf/server.xml

Sed-I's Universe 8005 / opt/tomcat02/conf/server.xml 8005 / 8002

AJP is usually not used, it is closed here.

Sed-I'/ 8009 Compact d' / opt/tomcat01/conf/server.xml

Sed-I'/ 8009 Compact d' / opt/tomcat01/conf/server.xml

The default working mode of tomcat under Linux is bio, and the performance is very low. It is recommended to use apr or nio.

This is changed to nio, that is, non-blocking IO, and the performance is better.

Sed-i.bak 's copyright HTTP hand 1.1 milliorg.apache.coyote.http11.Http11NioProtocoloration'/ opt/tomcat01/conf/server.xml

Sed-i.bak 's copyright HTTP hand 1.1 milliorg.apache.coyote.http11.Http11NioProtocoloration'/ opt/tomcat02/conf/server.xml

4. Create a startup file

Cd / usr/lib/systemd/system

Cat > tomcat01.service

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report