[Bro] running some code on only one cluster node

David Mandelberg dmandelb at bbn.com
Mon Mar 25 09:24:17 PDT 2013


Hi,

I'm working on a script that aggregates data into a &synchronized and
&mergeable table, then processes that table on a regular interval. The
code to process that table only needs to be run on one node. What's the
best way to do that?


Would something like this work?

@if (Cluster::local_node_type() in {Cluster::MANAGER, Cluster::NONE})
<code for only one node>
@endif


Or should I do something more like this?

const table_processor = "" &redef;
@if (!Cluster::is_enabled() || Cluster::node == table_processor)
<code for only one node>
@endif




More information about the Bro mailing list