sakserv/hadoop-mini-clusters

Connecting to Storm MiniCluster via NimbusClient

Closed this issue · 3 comments

Is it possible to connect via NimbusClient via MiniCluster?

List<String> stormNimbusSeeds = new ArrayList<>();
stormNimbusSeeds.add("localhost");
stormNimbusSeeds.add("192.168.26.139");
conf.put(Config.NIMBUS_SEEDS, stormNimbusSeeds);
ZookeeperLocalCluster zookeeperLocalCluster = new ZookeeperLocalCluster.Builder()
        .setPort(12345)
        .setTempDir("embedded_zookeeper")
        .setZookeeperConnectionString("localhost:12345")
        .setMaxClientCnxns(60)
        .setElectionPort(20001)
        .setQuorumPort(20002)
        .setDeleteDataDirectoryOnClose(false)
        .setServerId(1)
        .setTickTime(2000)
        .build();
zookeeperLocalCluster.start();
StormLocalCluster stormLocalCluster = new StormLocalCluster.Builder()
            .setZookeeperHost("localhost")
            .setZookeeperPort(12345L)
            .setEnableDebug(true)
            .setNumWorkers(1)
            .setStormConfig(new Config())
            .build();
stormLocalCluster.start();
NimbusClient nimbusClient = NimbusClient.getConfiguredClient(conf);

09:47:11.280 [main] WARN org.apache.storm.utils.NimbusClient - Ignoring exception while trying to get leader nimbus info from localhost. will retry with a different seed host.
java.lang.RuntimeException: org.apache.storm.thrift.transport.TTransportException: java.net.ConnectException: Connection refused (Connection refused)

@creed30 - Thanks for the report. I've not tested this before, so I'm unsure. I'll take a look when time permits.

One quick thing to try. I noticed when creating the StormLocalCluster you are instantiating a new Config object. Have you tried passing in the populated Config object you created with the Nimbus details?

Thanks.

I have, but maybe I am missing a Config? Is there a list of required properties that you might be able to point me towards?

@creed30 - I'm getting ready to merge a pull request that fixes this issue. You can now use NimbusClient as follows. A test has been added to instantiate the NimbusClient and get the config, validating it is not empty.

NimbusClient nimbusClient = NimbusClient.getConfiguredClient(stormLocalCluster.getStormConf());

Please feel free to reopen this if you are still having issues. Thanks!