Linux configuration tomcat running remote monitoring (JMX)

Source: Internet
Author: User
Tags tomcat server jconsole

In practical use, we often monitor tomcat performance. You need to configure the appropriate parameters to provide remote connections to monitor the performance of the Tomcat server. This article describes in detail how to configure the Tomcat parameters in step-by-step. Allow remote connection monitoring.

Tools/Materials
    • Vmware
    • Xshell
    • JDK under Jconsole plugin
Method/Step
  1. First make sure the Java environment is configured under Linux, that is, Tomcat and JDK are configured, and Tomcat can be started. Edit the/bin/catalina.sh file under the Tomcat directory.

    Insert a line before "#-----Execute The requested Command-------------" (there is no line break in the middle),

    The content is as follows (where 9999 is the monitoring port, please fill in the port to replace it): catalina_opts= "$CATALINA _opts

    -djava.rmi.server.hostname=192.168.2.201

    -dcom.sun.management.jmxremote

    -dcom.sun.management.jmxremote.port=9999-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=true "

    The changes are complete and saved. (192.168.2.201 replaced with server address)

  2. Go to the JDK installation directory, under the/jre/lib/management directory, to view the files. and modify the Jmxremote.access file, the last two lines of the file display "Monitorrole and controlrole" comment cancellation, where monitorrole is only the role of read-only permissions, Controlrole have higher permissions: Read-write, and so on. After editing is complete, save.

  3. By default, the Jmxremote.password file does not exist in this directory, we can rename the Jmxremote.password.template file, or copy it and rename it, and then modify the Jmxremote.password file. Also uncomment the last two lines of the file to show "Monitorrole and Controlrole". and then save.

  4. Change the permissions for Jmxremote.password and jmxremote.access files to 600. (Command: chmod jmxremote.password)

  5. Restart Tomcat to see if the port is started. Startup is configured to complete.

  6. Use the Jconsole plugin that comes with the JDK for connectivity testing. If the various parameters are filled in correctly, the connection is still unsuccessful, please check the Linux environment, the/etc/hosts file, the IP will be changed to the Linux host IP, then save, restart the machine, start Tomcat again, using the Jconsole plug-in monitoring can be successful.

    END
Precautions
    • Note When you change file permissions, you must have 600 permissions, and other permissions will cause Tomcat to not start up.
    • Monitoring port that block, the port can be set according to their actual situation, but do not occupy the existing port.

Linux configuration tomcat running remote monitoring (JMX)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.