Article Title: Basic Linux commands and Tomcat maintenance. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Monitor the average CPU usage. After SSH to the Linux server, type uptime to display the CPU usage of 1 minute ago, 5 minutes ago, and 10 minutes ago. The closer this value is to 0, the better.
Monitor memory and swap partition usage. After SSH to the Linux server, enter free-m to display the memory and swap partition usage. If the memory usage exceeds 90% and the swap space usage exceeds 50%, verify that the system is faulty. (At least Memory leakage occurs)
Monitor hard disk usage. After SSH to the Linux server, type df-h to view the hard disk usage in a user-friendly manner. If the usage exceeds 90%, useless data and logs need to be cleared in time.
Monitor the CPU usage and CPU and memory usage of each process. After SSH is sent to the Linux server, Type top-cs to view the allocation of resources occupied by the detailed process according to the CPU and memory usage.
Monitor the number of Apahce connections. After SSH to the Linux server, type ps-ef | grep httpd | wc-l to view the Apache at that time. This depends on the Apache connection count setting. If the number of connections exceeds the set value of 80%, it proves unstable.
PostFix Solution
Run the tail-f/var/log/maillog command to check the running status of the postfix email server.
Start PostFix
Service httpd start
Service mysqld start
Service postfix start
Service courier-authlib start
Service dovecot start
Service spamassassin start
Service mail1_start
Service saslauthd start
Services required to start the mail service
Restart PostFix
Service httpd start
Postfix restart
Do not restart the server, only restart POSTFIX
Tomcat solution: the Tomcat log is in the logs folder under the installation directory. You can view the Tomcat log query problem.
Close the Tomcat process and type in the bin directory under the Tomcat installation directory. /shutdown. sh & kill-9 $ (ps-ef | grep java | awk '{print $2}') can kill all Tomcat processes, and then type. /startup. sh to restart Tomcat
Integration of Apache and Tomcat
1、upload jakarta-tomcat-connectors-1.2.15-src.tar.gz to the server and unzip it to get the jakarta-tomcat-connectors-1.2.15-src
2. To the jakarta-tomcat-connectors-1.2.15-src/jk/native directory
[Root @ localhost native] #./configure -- with-apxs =/usr/sbin/apxs
[Root @ localhost native] # make
[Root @ localhost native] # su-c 'make install'
Mod_jk2.so is automatically copied to the/usr/lib/httpd/modules/mod_jk.so directory.
3. Load mod_jk on apache
[Root @ localhost conf] # vi/etc/httpd/conf/httpd. conf
Add the following code:
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule jk_module modules/mod_jk.so
JkWorkersFile/etc/httpd/conf/workers. properties
# Static files in the examples webapp are served by apache
Alias // home/cviepanel/java/jakarta-tomcat-5.0.28/webapps/
4. Add the workers. properties file to/etc/httpd/conf.
# Define 1 real worker using ajp13
Worker. list = worker1
# Set properties for worker1 (ajp13)
Worker. worker1.type = ajp13
Worker. worker1.host = 127.0.0.1
Worker. worker1.port = 8009
Worker. worker1.lbfactor = 1
Worker. worker1.cachesize = 10
Worker. worker1.cache _ timeout = 600
Worker. worker1.socket _ keepalive = 1
Worker. worker1.reclycle _ time out = 300