您当前的位置: 首页 >  zookeeper

衣舞晨风

暂无认证

  • 2浏览

    0关注

    1156博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

通过 JMX 监控Zookeeper

衣舞晨风 发布时间:2017-03-25 09:18:27 ,浏览量:2

修改zookeeper的启动脚本vim zkServer.sh。 找到启动参数ZOOMAIN:

# use POSTIX interface, symlink is followed automatically
ZOOBIN="${BASH_SOURCE-$0}"
ZOOBIN="$(dirname "${ZOOBIN}")"
ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"

if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
  . "$ZOOBINDIR/../libexec/zkEnv.sh"
else
  . "$ZOOBINDIR/zkEnv.sh"
fi

# See the following page for extensive details on setting
# up the JVM to accept JMX remote management:
# http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
# by default we allow local JMX connections
if [ "x$JMXLOCALONLY" = "x" ]
then
    JMXLOCALONLY=false
fi

if [ "x$JMXDISABLE" = "x" ] || [ "$JMXDISABLE" = 'false' ]
then
  echo "ZooKeeper JMX enabled by default" >&2
  if [ "x$JMXPORT" = "x" ]
  then
    # for some reason these two options are necessary on jdk6 on Ubuntu
    #   accord to the docs they are not necessary, but otw jconsole cannot
    #   do a local attach
    ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain"
  else
    if [ "x$JMXAUTH" = "x" ]

修改为下面值(修改一项,新增4项):

 Dcom.sun.management.jmxremote.local.only=false
 # jconsole.exe 连接的ip地址(zk所在机器的ip)
 Djava.rmi.server.hostname=192.168.179.128
  # jconsole.exe 连接的端口号
 Dcom.sun.management.jmxremote.port=8989
 Dcom.sun.management.jmxremote.ssl=false
 Dcom.sun.management.jmxremote.authenticate=false  

如果需要用jmx管理多台zk服务器,每台服务器的启动脚本都需要进行如上修改。

在本机找到jconsole.exe(jdk自带的工具,一般在:Java\jdk1.8.0_121\bin目录下):

双击选择:

这里写图片描述

点击连接按钮 这里写图片描述

选择:【不安全的连接】

这里写图片描述

zookeeper暴露的信息: 这里写图片描述

作者:jiankunking 出处:http://blog.csdn.net/jiankunking

关注
打赏
1647422595
查看更多评论
立即登录/注册

微信扫码登录

0.0513s