반응형

Authentication 미적용 설정

원격 서버에서 java 애플리케이션 실행

  • 앱 : spring-example.jar
  • 서버 주소 : 192.168.56.116
  • VisualVM 접속 포트 : 8500
  • 주의사항 : -jar spring-example.jar 명령이 마지막에 와야함
java \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.port=8500 \
-Dcom.sun.management.jmxremote.rmi.port=8500 \
-Djava.rmi.server.hostname=192.168.56.116 \
-jar spring-example.jar

VisualVM으로 원격 접속

  • Remote 우클릭 > Add Remote Host
    • Host name : 192.168.56.116
  • Remote > 192.168.56.116 우클릭 > Add JMX Connection
    • Connection : 192.168.56.116:8500
  • OK 버튼 클릭해서 접속

Authentication 적용 설정

Authentication 파일 생성

vi /home/ubuntu/jmxremote.access
# jmxremote.access
monitorRole readonly
controlRole readwrite
vi /home/ubuntu/jmxremote.password
# jmxremote.password
monitorRole 123456
controlRole 123456
chmod 600 /home/ubuntu/jmxremote.*

원격 서버에서 java 애플리케이션 실행

  • 앱 : spring-example.jar
  • 서버 주소 : 192.168.56.116
  • VisualVM 접속 포트 : 8500
  • 주의사항 : -jar spring-example.jar 명령이 마지막에 와야함
java \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=8500 \
-Dcom.sun.management.jmxremote.authenticate=true \
-Dcom.sun.management.jmxremote.password.file=/home/ubuntu/jmxremote.password \
-Dcom.sun.management.jmxremote.access.file=/home/ubuntu/jmxremote.access \
-Dcom.sun.management.jmxremote.ssl=false \
-Djava.rmi.server.hostname=192.168.56.116 \
-jar spring-example.jar

VisualVM으로 원격 접속

  • Remote 우클릭 > Add Remote Host
    • Host name : 192.168.56.116
  • Remote > 192.168.56.116 우클릭 > Add JMX Connection
    • Connection : 192.168.56.116:8500
    • Username : controlRole
    • Password: 123456
  • OK 버튼 클릭해서 접속

참고

반응형

'Development > Java' 카테고리의 다른 글

[Java] JWT(Json Web Token)  (0) 2020.12.28
[Java] Markdown 파싱  (0) 2020.12.28
[Java] JDK 버전별 신규 기능  (0) 2019.04.21
[Java] XML 파싱  (0) 2019.03.20
[Java] Json Handling(with Jackson)  (0) 2019.03.20

+ Recent posts