我运行了一些java代码,它将上传:storm-starter-topologies-0.9.6.jar 从示例中,控制台显示:
535 [main] INFO backtype.storm.StormSubmitter - 将拓扑jar C:\ apachestorm096 \ examples \ storm-starter \ storm-starter-topologies-0.9.6.jar上传到指定位置:¨/ usr / local / storm /data¨/nimbus/inbox/stormjar-8b5acdaf-e6ce-4b01-9ea9-9bd92e30f417.jar
1066 [main] INFO backtype.storm.StormSubmitter - 已成功将拓扑jar上传到指定位置:¨/ usr / local / storm /data¨/ nimbus / inbox / stormjar-8b5acdaf-e6ce-4b01-9ea9-9bd92e30f417.jar
但我也得到错误:
线程“main”中的异常org.apache.thrift7.TApplicationException:submitTopology失败:无序响应
在风暴UI中显示提交的拓扑... 但没有任何事情发生,没有溪流,没有鲸鱼喷水,没有螺栓......没有工人...... Eclipse在本地运行,并在虚拟机上运行storm + zookeeper。
这是代码:
TopologyBuilder builder = new TopologyBuilder();
Config conf = new Config();
conf.put(Config.NIMBUS_HOST, "100.0.0.26");
conf.put(Config.STORM_ZOOKEEPER_PORT, "2181");
conf.setNumWorkers(20);
conf.setMaxSpoutPending(5000);
StormSubmitter submitter = new StormSubmitter();
conf.setDebug(true);
Map storm_conf = Utils.readStormConfig();
storm_conf.put("nimbus.host", "100.0.0.26");
Client client = NimbusClient.getConfiguredClient(storm_conf).getClient();
try {
NimbusClient nimbus = new NimbusClient(storm_conf, "100.0.0.26", 6627);
//submitter.submitTopology("blub", conf, builder.createTopology());
String inputJar = "C:\\apachestorm096\\examples\\storm-starter\\storm-starter-topologies-0.9.6.jar";
// upload topology jar to Cluster using StormSubmitter
String uploadedJarLocation = StormSubmitter.submitJar(storm_conf,inputJar);
System.out.println("Try ... ");
try {
String jsonConf = JSONValue.toJSONString(storm_conf);
System.out.println("Config : " + jsonConf );
nimbus.getClient().send_getNimbusConf();
Thread.sleep(5000);
System.out.println("Out of sleep ... ");
nimbus.getClient().submitTopology("word-count", uploadedJarLocation, jsonConf, builder.createTopology());
} catch (AlreadyAliveException e) { // (AlreadyAliveException ae) {
e.printStackTrace();
}
答案 0 :(得分:0)
抛出错误,因为设置的配置参数太少。 我忘了设置NIMBUS_THRIFT_PORT,我也改变了配置定义的方式......
TopologyBuilder builder = new TopologyBuilder();
Map conf = new HashMap();
//Map conf = Utils.readStormConfig();
conf.put(Config.NIMBUS_HOST, "100.0.0.26");
conf.put(Config.NIMBUS_THRIFT_PORT , 6627 );
conf.put(Config.STORM_ZOOKEEPER_PORT, 2181 );
conf.put(Config.TOPOLOGY_WORKERS , 4);
conf.put("storm.thrift.transport", "backtype.storm.security.auth.SimpleTransportPlugin");