jprofiler监控docker部署的jvm服务

1,官网下载jprofiler,此处我们选择jprofiler9.2.1版本:https://www.ej-technologies.com/download/jprofiler/version_92
在这里插入图片描述
Profiler 9.2 注册码
L-Larry_Lau@163.com#23874-hrwpdp1sh1wrn#0620
L-Larry_Lau@163.com#36573-fdkscp15axjj6#25257
L-Larry_Lau@163.com#5481-ucjn4a16rvd98#6038

2 安装windows版本

3 安装linux版本

docker exec -it 容器名 bash

cd /usr/local
tar -xvf jprofiler_linux_9_2_1.tar.gz
cd jprofiler9/

在这里插入图片描述
4 开启映射端口
宿主机执行脚本(脚本执行有任何问题可以私信我)

sh mapping_port.sh 容器名:8849:8849

#!/bin/bash

##该脚本用于设置容器端口映射到宿主机端口的功能

basepath=$(cd `dirname $0`; pwd)

if [ $# -ne 2 ]
then
  echo "ERROR:格式不正确,应该为: containerName:port fatherIp:port "
  echo -e "例如:将容器 1.node3的端口3306映射到宿主机192.168.30.210上的13306端口,那么命令如下:\n
  $0 1.node3:3306 192.168.30.210:13306"
  exit 1
fi

containerName=`echo $1 | cut -d \: -f 1`
containPort=`echo $1 | cut -d \: -f 2`
fatherIp=`echo $2 | cut -d \: -f 1`
fatherPort=`echo $2 | cut -d \: -f 2`

#根据容器名称获取容器ip地址
containerIp=`docker exec -ti ${containerName} ifconfig eth1 | grep "inet addr:" | awk -F " " '{print $2}' | awk -F ":" '{print $2}'`

iptables -t nat -A DOCKER -p tcp -d 0/0 --dport ${fatherPort} -j DNAT --to-destination ${containerIp}:${containPort}
iptables -t nat -A POSTROUTING -s ${containerIp}/32 -d ${containerIp}/32 -p tcp -m tcp --dport ${containPort} -j  MASQUERADE
iptables -t filter -A DOCKER -d ${containerIp}/32 -p tcp -m tcp --dport ${containPort} -j ACCEPT
iptables -I INPUT -p tcp --dport ${fatherPort} -j ACCEPT


5 使用windows 连接 宿主机

在这里插入图片描述

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大道至简@EveryDay

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值