Java - jmx远程调优

> java远程调优可采用两种方式进行连接,`jmx`与`jstatd`,此文演示如何配置`jmx`进行连接调优。

## 配置指南

|配置|功能|值|备注|

|---|---|---|---|

|-Dcom.sun.management.jmxremote.authenticate|connection authenticate|true / false||

|-Dcom.sun.management.jmxremote.port|jmx connection remote port|1~65535||

|-Dcom.sun.management.jmxremote.local.only|remote can connection|true / false||

|-Dcom.sun.management.jmxremote.ssl|enable ssl connection|true / false||

|-Djava.rmi.server.hostname|multi eth choose|ip / domain||

|-Dcom.sun.management.jmxremote.access.file|remote access roles|file path||

|-Dcom.sun.management.jmxremote.password.file|remote authenticate file when auth config enable|file path||

## Demo1

不启用认证

```

java \

-Dcom.sun.management.jmxremote.authenticate=false \

-Dcom.sun.management.jmxremote.port=5555 \

-Dcom.sun.management.jmxremote.ssl=false \

-Djava.rmi.server.hostname=test.domain.dounine.com \

-jar test-jar-1.0.jar

```

## Demo2

启用用户认证

```

java \

-Dcom.sun.management.jmxremote.authenticate=true \

-Dcom.sun.management.jmxremote.port=5555 \

-Dcom.sun.management.jmxremote.access.file=./jmxremote.access \

-Dcom.sun.management.jmxremote.password.file=./jmxremote.password \

-Dcom.sun.management.jmxremote.ssl=false \

-Djava.rmi.server.hostname=test.domain.dounine.com \

-jar test-jar-1.0.jar

```

编辑`./jmxremote.access`权限文件

```

dounine readwrite

```

编辑`./jmxremote.password`密码文件

```

dounine 你的密码

```

增加访问权限

```

chmod 400 ./jmxremote.access

chmod 400 ./jmxremote.password

```

启动`jvisualvm`或者`jconsole`

```

jvisualvm

# 或者

jconsole

```

## jvisualvm

添加远程主机地扯

![](http://upload-images.jianshu.io/upload_images/9028759-fe64a8144023405a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

添加`jmx`端口

![](http://upload-images.jianshu.io/upload_images/9028759-9f4db411d414b74b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

授权配置

![](http://upload-images.jianshu.io/upload_images/9028759-1fe88e88e8a8291c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

已连接视图

![](http://upload-images.jianshu.io/upload_images/9028759-96785e80eb4bf1ea.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

---

![](https://upload-images.jianshu.io/upload_images/9028759-5619fe0d9edd7a1b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • java远程调优可采用两种方式进行连接,jmx与jstatd,此文演示如何配置jmx进行连接调优。 配置指南 De...
    大猪大猪阅读 221评论 0 2
  • java远程调优可采用两种方式进行连接,jmx与jstatd,此文演示如何配置jmx进行连接调优。 配置指南 De...
    大猪大猪阅读 277评论 0 0
  • java远程调优可采用两种方式进行连接,jmx与jstatd,此文演示如何配置jmx进行连接调优。 配置指南 De...
    大猪大猪阅读 236评论 0 4
  • java远程调优可采用两种方式进行连接,jmx与jstatd,此文演示如何配置jmx进行连接调优。 配置指南 De...
    大猪大猪阅读 166评论 0 1
  • 曾经我的心就像一片海, 里面装满了思虑愁烦、无助无奈, 我痛苦挣扎、我孤独徘徊, 那片海整日里风雨嘶吼、起伏翻腾,...
    凌贤武阅读 559评论 0 3