学习Strom DRPC时,参照
https://github.com/nathanmarz/storm/wiki/Distributed-RPC
进行操作,Local 没问题。
但向Strom Cluster上部署后,执行测试程序无响应。
查看Storm UI,发现有异常:
java.lang.RuntimeException: No DRPC servers configured for topology
at backtype.storm.drpc.DRPCSpout.
at backtype.storm.daemon.
at backtype.storm.util$async_
at clojure.lang.AFn.run(AFn.java:
at java.lang.Thread.run(Thread.
baidu、google后,发现也有人遇到同样的问题,但没有找到解决办法。后经过不断尝试,发现原来是DRPC配置文件问题,需要在所有的Nimbus和Supervisor节点上,都在配置文件上加上DRPC Server的配置,修改后可以执行。
具体步骤如下:
- Configure the locations of the DRPC servers, 注意修改所有节点的配置文件。
- Launch DRPC server(s) , 启动DRPC server,命令为 "storm drpc"
- Submit DRPC topologies to Storm cluster, 和提交普通的topology一样,打好jar包,使用storm jar 提交。需要注意的是,需要在main函数中执行一下代码,将topology提交止remote cluster上:
StormSubmitter.submitTopology("exclamation-drpc", conf, builder.createRemoteTopology());
测试程序:
DRPCClient client = new DRPCClient("xx.xx.xx.xx", 3772); String result = client.execute("exclamation-drpc", "http://twitter.com");