第一步:
配置catalina.sh
在# ----- Execute The Requested Command -----------------------------------之前
JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=256m"
if [ "$1" = "start" ];then
echo "set console";
# JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=256m"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=60001 -Djava.rmi.server.hostname=42.96.84.84";
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false";
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false";
# JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.pwd.file=/root/soft/jdk7/jre/lib/management/jmxremote.password"
else
echo "no startup";
fi;
Remarks:
This step requires Note that port is the port specified by yourself, and the hostname must be the real IP address of the server.
Step 2 :
Edit jmxremote.access and jmxremote.password
Bash code
1.cd /usr/java/jdk1.6.0_18/jre/lib/management
2. mv jmxremote.password.template jmxremote.password
3.chmod 600 jmxremote.access jmxremote.password
4.vi jmxremote.password
jmxremote.access Generally, keep the original content unchanged.
For jmxremote.password, uncomment:
# monitorRole mzxwswj
# controlRole mzxwswj
pound sign. The monitorRole is a role with only read-only permissions, and the controlRole has higher permissions: read and write, etc.
third step:
Finally, add the port to the firewall trust list
Bash code
1.vi /etc/sysconfig/iptables
Edit iptables and add a new line: -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp -- dport 60001 -j ACCEPT
Step 4:
Modify the host IP
vi /etc/hosts
Modify 127.0.0.1 to the real IP address
vi /etc/sysconfig/network
Modify hostname to the real IP address
jconsole monitoring remote server
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326456196&siteId=291194637
Recommended
Ranking