Storm UI访问无数据显示

集群安装完storm后在网页输入http://UI地址:8080时,页面只显示正面内容:

Storm UI

 

 

Cluster Summary

Nimbus Summary

Topology Summary

Supervisor Summary

Nimbus Configuration

而显示不出数据,打开网页控制台发现一个500的错误提示,然后点开错误的地址可以看到正面这样的错误提示:

{"error":"500 Server Error","errorMessage":"org.apache.storm.utils.NimbusLeaderNotFoundException: Could not find leader nimbus from seed hosts [\"10.211.55.17\"]. Did you specify a valid list of nimbus hosts for config nimbus.seeds?\n\tat org.apache.storm.utils.NimbusClient.getConfiguredClientAs(NimbusClient.java:120)

但是光这个信息拿去网络上去找多半说是问题出在zookeeper,

后来分析storm源码时发现还有其他情况,下面是NimbusClient.getConfiguredClientAs方法的源码:

    public static NimbusClient getConfiguredClientAs(Map conf, String asUser, Integer timeout) {
        if (conf.containsKey(Config.STORM_DO_AS_USER)) {
            if (asUser != null && !asUser.isEmpty()) {
                LOG.warn("You have specified a doAsUser as param {} and a doAsParam as config, config will take precedence."
                        , asUser, conf.get(Config.STORM_DO_AS_USER));
            }
            asUser = (String) conf.get(Config.STORM_DO_AS_USER);
        }

        List<String> seeds;
        if (conf.containsKey(Config.NIMBUS_HOST) && StringUtils.isNotBlank(conf.get(Config.NIMBUS_HOST).toString())) {
            LOG.warn("Using deprecated config {} for backward compatibility. Please update your storm.yaml so it only has config {}",
                     Config.NIMBUS_HOST, Config.NIMBUS_SEEDS);
            seeds = Lists.newArrayList(conf.get(Config.NIMBUS_HOST).toString());
        } else {
            seeds = (List<String>) conf.get(Config.NIMBUS_SEEDS);
        }

        for (String host : seeds) {
            int port = Integer.parseInt(conf.get(Config.NIMBUS_THRIFT_PORT).toString());
            NimbusSummary nimbusSummary;
            NimbusClient client = null;
            try {
                client = new NimbusClient(conf, host, port, timeout, asUser);
                nimbusSummary = client.getClient().getLeader();
                if (nimbusSummary != null) {
                    String leaderNimbus = nimbusSummary.get_host() + ":" + nimbusSummary.get_port();
                    LOG.info("Found leader nimbus : {}", leaderNimbus);
                    if (nimbusSummary.get_host().equals(host) && nimbusSummary.get_port() == port) {
                        NimbusClient ret = client;
                        client = null;
                        return ret;
                    }
                    try {
                        return new NimbusClient(conf, nimbusSummary.get_host(), nimbusSummary.get_port(), timeout, asUser);
                    } catch (TTransportException e) {
                        throw new RuntimeException("Failed to create a nimbus client for the leader " + leaderNimbus, e);
                    }
                }
            } catch (Exception e) {
                LOG.warn("Ignoring exception while trying to get leader nimbus info from " + host
                                 + ". will retry with a different seed host.", e);
                continue;
            } finally {
                if (client != null) {
                    client.close();
                }
            }
            throw new NimbusLeaderNotFoundException("Could not find a nimbus leader, please try " +
                                                            "again after some time.");
        }
        throw new NimbusLeaderNotFoundException(
                "Could not find leader nimbus from seed hosts " + seeds + ". " +
                        "Did you specify a valid list of nimbus hosts for config " +
                        Config.NIMBUS_SEEDS + "?");
    }

从源码中可以看到与页面错误链接提示信息一样的内容,这里抛出异常的是因为seeds集合循环结束,就意味着到不到nimbus.seeds的值,但是这个值我在storm.yaml里却有配置。

然后再往循环里深究,里面有几个catch会导致循环结果,然后拿这这些提示信息去找storm安装目录下logs/ui.log文件。

我这里是拿Found leader nimbus:这一句找,结果找到内容是:

Found leader nimbus: master.localdomain:6627

这里的6627是nimbus默认端口,而问题就出在master.localdomain这里,而hosts里配置的是只有master不带master.localdomain

 

解决方法:

 修改/etc/sysconfig/network文件

# vim /etc/sysconfig/network

增加一行或修改hostname的值

hostname=master

然后重启主机:reboot

重启后再启动storm,大功告成。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值