1: dockerfile 添加参数 JAVA_OPTS, 由docker-compose 中传入
如果需要用户名密码登录验证,
-Dcom.sun.management.jmxremote.authenticate=true 时 添加 下图 用户名密码文件并授权
-Dcom.sun.management.jmxremote.authenticate=false时, 不需要用户名密码文件
文件内容:
jmxremote.access
jmxremote.password
2: docker-compose指定jvm参数
防火墙记得放开端口
-Xms1024m
-Xmx1024m
-XX:+PrintGCDetails
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/usr/soft/dump
-Dcom.sun.management.jmxremote=true-Dcom.sun.management.jmxremote.port=31026
-Dcom.sun.management.jmxremote.rmi.port=31026 容器映射端口, 桥接模式下要设置-Djava.rmi.server.hostname=你的宿主机ip
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true 是否开启权限验证,如果开启需要有用户名和密码
-Dcom.sun.management.jmxremote.acccess.file=/root/jmxremote.access 指定用户的权限的文件-Dcom.sun.management.jmxremote.password.file=/root/jmxremote.password 指定用户名和密码的文件
3: 连接



