java - Assign strictly one special bolt on each machine in storm cluster -
java - Assign strictly one special bolt on each machine in storm cluster -
i start special bolt on every machine in cluster.
storm has pluggable scheduler, documentation scanty. there 1 understandable example xumingming. how implemented pattern using ischeduler
?
example
we have tcpbolt
, listens port 8765. tcpbolt
parallelism == cluster size. need start 1 instance of bolt on each machine.
the illustration , source code gives plenty demo code this.
first need set task number of tcpbolt host number of cluser.
then in ischeduler impl, using info in private map<string, schedulerassignmentimpl> assignments;
check if tcpbolt assign host ( in schedulerassignmentimpl, using info map<executordetails, workerslot> executortoslot;
)
finally, if not assigned, using next code assign
// re-get aviableslots availableslots = cluster.getavailableslots(specialsupervisor); // since demo, maintain things simple, assign // executors 1 slot. cluster.assign(availableslots.get(0), topology.getid(), executors);
this rough idea. hope helps.
java apache-storm
Comments
Post a Comment