码迷,mamicode.com
首页 > 其他好文 > 详细

zookeeper在单机上伪集群测试时,出现Unable to start AdminServer, exiting abnormally

时间:2014-12-08 21:23:58      阅读:1446      评论:0      收藏:0      [点我收藏+]

标签:zookeeper   分布式 hadoop 集群   

zookeeper在单机上伪集群测试时,出现Unable to start AdminServer, exiting abnormally

出现该问题的原因大家都知道因为启动完一个zookeeper server后,默认的zkServer.cmd中,没有将对应的不启动AdminServer屏蔽。

AdminServerFactory.java中代码如下

 public static AdminServer createAdminServer() {
        if (!"false".equals(System.getProperty("zookeeper.admin.enableServer"))) {
            try {
                Class<?> jettyAdminServerC = Class.forName("org.apache.zookeeper.server.admin.JettyAdminServer");
                Object adminServer = jettyAdminServerC.getConstructor().newInstance();
                return (AdminServer) adminServer;


            } catch (ClassNotFoundException e) {
                LOG.warn("Unable to start JettyAdminServer", e);
            } catch (InstantiationException e) {
                LOG.warn("Unable to start JettyAdminServer", e);
            } catch (IllegalAccessException e) {
                LOG.warn("Unable to start JettyAdminServer", e);
            } catch (InvocationTargetException e) {
                LOG.warn("Unable to start JettyAdminServer", e);
            } catch (NoSuchMethodException e) {
                LOG.warn("Unable to start JettyAdminServer", e);
            } catch (NoClassDefFoundError e) {
                LOG.warn("Unable to load jetty, not starting JettyAdminServer", e);
            }
        }
        return new DummyAdminServer();
    }

因为第一个启动的Zookeeper server已经把8080端口给占用了

根据创建JettyAdminServer中代码如下:

    public JettyAdminServer() throws AdminServerException {
        this(Integer.getInteger("zookeeper.admin.serverPort", DEFAULT_PORT),
             System.getProperty("zookeeper.admin.commandURL", DEFAULT_COMMAND_URL));
    }

所以可以在zkServer.cmd中的最后一个call参数中,增加"-Dzookeeper.admin.enableServer=false"


或者

"-Dzookeeper.admin.serverPort=你的端口号"  

更改端口号后再进行启动,这样在单机环境下配置集群测试就OK了



zookeeper在单机上伪集群测试时,出现Unable to start AdminServer, exiting abnormally

标签:zookeeper   分布式 hadoop 集群   

原文地址:http://blog.csdn.net/fibona/article/details/41809033

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!