我拿了示例字数统计代码并尝试提交到远程nimbus服务器而不提交LocalCluster。我在客户端使用以下代码,以下yaml配置服务器和ZK分别启动。
当我在客户端使用以下代码提交时,我遇到以下错误,当我运行./storm jar文件/ path / jar-file.jar
ut.pending":5000,"storm.zookeeper.servers":"149.160.221.43","topology.max.task.parallelism":3}
308 [main] WARN backtype.storm.StormSubmitter - Topology submission exception: Field storm.zookeeper.servers must be an Iterable of java.lang.String
Exception in thread "main" InvalidTopologyException(msg:Field storm.zookeeper.servers must be an Iterable of java.lang.String)
at backtype.storm.generated.Nimbus$submitTopology_result.read(Nimbus.java:2466)
at org.apache.thrift7.TServiceClient.receiveBase(TServiceClient.java:78)
at backtype.storm.generated.Nimbus$Client.recv_submitTopology(Nimbus.java:162)
at backtype.storm.generated.Nimbus$Client.submitTopology(Nimbus.java:146)
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:98)
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:58)
at storm.starter.WordCountTopology.main(WordCountTopology.java:110)
拓扑构建代码:
System.setProperty("storm.jar","/Users/lginnali/work/airavata/storm/storm/examples/storm-starter/target/storm-starter-0.10.0-SNAPSHOT.jar");
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("spout", new RandomSentenceSpout(), 5);
BoltDeclarer split = builder.setBolt("split", new SplitSentence(), 8);
split.shuffleGrouping("spout");
builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word"));
Config conf = new Config();
conf.put(Config.NIMBUS_HOST, "localhost");
conf.put(Config.NIMBUS_THRIFT_PORT,6627);
conf.put(Config.STORM_ZOOKEEPER_PORT,2181);
conf.put(Config.STORM_ZOOKEEPER_SERVERS,"localhost");
conf.setNumWorkers(20);
conf.setMaxSpoutPending(5000);
if (args != null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
}
示例storm.yaml看起来像这个文件。
https://github.com/apache/storm/blob/master/conf/defaults.yaml
答案 0 :(得分:1)
异常说明的是:Config.STORM_ZOOKEEPER_SERVERS应该是一个可迭代的字符串,而不是一个字符串。所以尝试替换
conf.put(Config.STORM_ZOOKEEPER_SERVERS,"localhost");
带
conf.put(Config.STORM_ZOOKEEPER_SERVERS, Arrays.asList(new String[]{"localhost"}));
答案 1 :(得分:1)
问题可能是由于storm.yaml文件中的错误,请确保storm.zookeeper.server对应的条目采用下面给出的格式: storm.zookeeper.server: (空格) - (空格)“ip-address”.i.e连字符和ip-address之间以及新行的开头之间应该有一个空格。