背景说明
zookeeper单机启动两个进程出现了端口冲突,报错信息如下
[root@ljhan2 bin]# cat zookeeper.out
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9999; nested exception is: java.net.BindException: Address already in use (Bind failed)
[root@ljhan2 bin]#
解决方案
查看启动脚本
33 if [ "x$JMXDISABLE" = "x" ]
34 then
35 echo "JMX enabled by default" >&2
36 # for some reason these two options are necessary on jdk6 on Ubuntu
37 # accord to the docs they are not necessary, but otw jconsole cannot
38 # do a local attach
39 #ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zook eeper.server.quorum.QuorumPeerMain"
40 ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote. ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain"
41 else
42 echo "JMX disabled by user request" >&2
43 ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
44 fi
修改其中端口号9999
为8888
即可,再次启动发现问题解决。
网友评论