Storm DRPC

来源:互联网 发布:csol怒海狂鲨数据 编辑:程序博客网 时间:2024/05/21 17:44
什么是DRPC
–RPC(Remote Procedure Call Protocol)——远程过程调用协议
–Distributed RPC:rpc请求流式、并进行处理
–RPC请求参数当做输入流,结果当做输出流
–利用storm的分布式进行处理机制和能力
–借助DRPC server接收请求、返回相应
Storm只能获取数据,不能接请求和发响应,所以这里借助一个DRPC Server来帮助完成。

DRPC服务器协调:①接收一个RPC请求②发送请求到storm topology③从storm topology接收结果④把结果发回给等待的客户端。

DRPC把大量请求分布式的去做,一次请求如果串行的话可能会比较慢,我并行的来处理,另一方面通过来降低平均一次请求的时间,解决了响应的吞吐。


DRPC的Hello World:



启用DRPC:

#修改storm.yaml中的drpc.servers配置
cd /root/apache-storm-0.9.5
vi conf/storm.yaml
drpc.servers:
-"localhost"

#启动DRPC server
./bin/storm drpc>> ./logs/drpc.out 2>&1 &
tail -f ./logs/drpc.log

#提交到storm集群,检测webui
./bin/storm jar target/storm-starter-0.9.5 jar
Storm.starter.manualDRPC

#测试DRPC服务
./src/storm/strom-core/src/py/storm/distributedrpc-remote
-h localhost:3772 –f execute exclaim test
U”test!!!”


原创粉丝点击