出于某种奇怪的原因,我无法使用VisualVM或连接jconsole到JMX.
用于启动要监视的VM的参数:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1100
我检查过,我可以从本地和远程telnet到这个端口.
尽管如此,在花费了相当多的时间尝试之后,VisualVM或jconsole仍无法连接.
REMOTE MACHINE with JMX (debian)
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
MY WORKSTATION (OS X)
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
Run Code Online (Sandbox Code Playgroud)
问题是什么?
我想在我的Kubernetes集群上描述我的播放应用程序.
我使用的是VisualVM,我采取的步骤如下:
使用以下参数运行我的播放应用程序:
"-Dcom.sun.management.jmxremote",
"-Dcom.sun.management.jmxremote.ssl=false",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.port=1098"
Run Code Online (Sandbox Code Playgroud)我的形象有 apt-get install -y visualvm
kubectl port-forward <Container> 1098我不确定我在这里做错了什么.在localhost上运行应用程序时(不是通过IDE,直接从启动脚本运行)一切正常.
更新1,部署和服务
Run Code Online (Sandbox Code Playgroud)apiVersion: extensions/v1beta1 kind: Deployment metadata: name: myApp labels: name: myApp spec: replicas: 1 strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 0 type: RollingUpdate template: metadata: name: myApp labels: name: myApp spec: containers: - name: myApp image: ... args: ["-Dcom.sun.management.jmxremote", "-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.port=1098"] ports: - containerPort: 9000 env: ...
apiVersion: v1
kind: Service
metadata:
name: myApp
labels:
name: myApp
spec:
selector:
name: …Run Code Online (Sandbox Code Playgroud)