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

Multi-node Tomcat uses NFS service to realize directory sharing

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

Share

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

1. NFS application scenarios

1. NFS (Network File system) is a network file system protocol based on TCP/IP transport.

2. By using the NFS protocol, the NFS client can access shared resources in the remote NFS server as if it were a local directory.

3. In the work scene of enterprise cluster architecture, especially in small and medium-sized website companies, NFS network file system is generally used to store shared videos, pictures and other static resource files. For example, put the files uploaded by website users into the NFS share, so that other servers on the network can mount and access the data in the shared directory through network sharing.

II. System environment

1. A Centos7 is bound to the same network card vnet1:192.168.80.100 as a NFS server.

2. Two Centos7 are used as Tomcat servers and bound to the same network card vnet1.

The corresponding IP addresses are: 192.168.80.120

192.168.80.130

3. The corresponding topology diagram is as follows:

Among them, the test terminal is the win10 real machine, the NFS server uploads the mall project, and the tomcat is mounted to the NFS server, which is most accessed by the test terminal.

III. Deployment of NFS server in case column

1. Install nfs-utils and rpcbind software packages

Yum install nfs-utils rpcbind-y

2. Set up a shared directory

Vi / etc/exports / / compile configuration file

Add the following

/ opt/tomcatpub * (rw,sync) / / specify the path and permissions of the shared directory mkdir / opt/tomcatpub / / create a new shared directory chown nfsnobody / opt/tomcatpub / / directory rights

Upload the mall project

Tar xf SLSaleSystem.tar.gz-C / opt/tomcatpub/ extract the mall project to a shared directory

3. Start NFS service verification

Systemctl start rpcbind / / start systemctl start nfs / / and then start the deployment tomcat server (both have the same configuration)

Description:

Because the tomat server is running in the jdk environment, the first step is to build the jdk environment.

1. Set up the jdk environment

Tar xvf jdk-8u144-linux-x64.tar.gz / / extract jdkcp-r jdk1.8.0_144/ / usr/local/java/ / copy the files under the extracted jdk to the java directory vi / etc/profile / / add the jdk system variable export JAVA_HOME=/usr/local/javaexport JRE_HOME=/usr/local/java/jreexport PATH=$PATH:/usr/local/java/binexport CLASSPATH=./:/usr/local/java/lib:/ Usr/local/java/jre/libsource / etc/profile / / refresh the file java-version / / check the version successfully indicates that the environment has been set up successfully

2. Install tomcat

Tar xvf apache-tomcat-8.5.23.tar.gz / / extract package cp-r apache-tomcat-8.5.23 / usr/local/tomcat8 / / copy the extracted package to the tomcat8 directory

/ / the tomcat startup command software is linked to the directory of the system command to rename it to tomcatup for convenience.

Ln-s / usr/local/tomcat8/bin/startup.sh / usr/bin/tomcatup ln-s / usr/local/tomcat8/bin/shutdown.sh / usr/bin/tomcatdown

Tomcatup / / start tomcat

3. Install nfs service on the tomcat server

Yum install nfs-utils rpcbind-ysystemctl start rpcbind / / start systemctl start nfs / / then start

4. View the shared directory on the nfs server

Showmount-e 192.168.80.100

5. Add a mount point

Mkdir / root/aa / / New mount directory mount 192.168.80.100:/opt/tomcatpub / root/aa / / Mount the new directory to the NFS shared directory. Df-hT / / check whether the mount is successful

Ls / root/aa / / View the mount directory

The mall project is not uploaded to its own tomcat server, while the mall project on the file server appears in the mount directory

6. Modify the main configuration file of tomcat

Vi / usr/local/tomcat8/conf/server.xml

Specify the path to the project under the webapps site

Tomcatdown

Tomcatup / / restart the tomcat server

7. Verify whether it is successful

Visit 192.168.80.120VR 8080

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