mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
cluster: Rename setup-connections to setup-subscriptions
Now that all the logic about establishing connections among nodes has moved to the broker policy script, the setup-connections name seems unfortunate, transition away from it.
This commit is contained in:
parent
351bd7b81b
commit
d122894d0d
6 changed files with 52 additions and 49 deletions
|
@ -43,7 +43,7 @@ redef Cluster::manager_is_logger = F;
|
||||||
|
|
||||||
@if ( Cluster::node in Cluster::nodes )
|
@if ( Cluster::node in Cluster::nodes )
|
||||||
|
|
||||||
@load ./setup-connections
|
@load ./setup-subscriptions
|
||||||
|
|
||||||
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
@load ./nodes/manager
|
@load ./nodes/manager
|
||||||
|
|
|
@ -346,7 +346,7 @@ function pool_sorter(a: Pool, b: Pool): int
|
||||||
return strcmp(a$spec$topic, b$spec$topic);
|
return strcmp(a$spec$topic, b$spec$topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Needs to execute before the zeek_init in setup-connections
|
# Needs to execute before the zeek_init in setup-subscriptions
|
||||||
event zeek_init() &priority=-5
|
event zeek_init() &priority=-5
|
||||||
{
|
{
|
||||||
if ( ! Cluster::is_enabled() )
|
if ( ! Cluster::is_enabled() )
|
||||||
|
|
|
@ -1,48 +1,3 @@
|
||||||
##! This script establishes communication among all nodes in a cluster
|
@deprecated "Remove in v9.1: Load base/frameworks/cluster/setup-subscriptions instead"
|
||||||
##! as defined by :zeek:id:`Cluster::nodes`.
|
|
||||||
|
|
||||||
@load ./main
|
@load ./setup-subscriptions
|
||||||
@load ./pools
|
|
||||||
|
|
||||||
module Cluster;
|
|
||||||
|
|
||||||
event zeek_init() &priority=-5
|
|
||||||
{
|
|
||||||
if ( getenv("ZEEKCTL_CHECK_CONFIG") != "" )
|
|
||||||
return;
|
|
||||||
|
|
||||||
local self = nodes[node];
|
|
||||||
|
|
||||||
for ( i in registered_pools )
|
|
||||||
{
|
|
||||||
local pool = registered_pools[i];
|
|
||||||
|
|
||||||
if ( node in pool$nodes )
|
|
||||||
Cluster::subscribe(pool$spec$topic);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( self$node_type ) {
|
|
||||||
case NONE:
|
|
||||||
return;
|
|
||||||
case CONTROL:
|
|
||||||
break;
|
|
||||||
case LOGGER:
|
|
||||||
Cluster::subscribe(Cluster::logger_topic);
|
|
||||||
break;
|
|
||||||
case MANAGER:
|
|
||||||
Cluster::subscribe(Cluster::manager_topic);
|
|
||||||
break;
|
|
||||||
case PROXY:
|
|
||||||
Cluster::subscribe(Cluster::proxy_topic);
|
|
||||||
break;
|
|
||||||
case WORKER:
|
|
||||||
Cluster::subscribe(Cluster::worker_topic);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Reporter::error(fmt("Unhandled cluster node type: %s", self$node_type));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Cluster::subscribe(nodeid_topic(Cluster::node_id()));
|
|
||||||
Cluster::subscribe(node_topic(node));
|
|
||||||
}
|
|
||||||
|
|
46
scripts/base/frameworks/cluster/setup-subscriptions.zeek
Normal file
46
scripts/base/frameworks/cluster/setup-subscriptions.zeek
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
##! This script contains the common subscription setup logic.
|
||||||
|
@load ./main
|
||||||
|
@load ./pools
|
||||||
|
|
||||||
|
module Cluster;
|
||||||
|
|
||||||
|
event zeek_init() &priority=-5
|
||||||
|
{
|
||||||
|
if ( getenv("ZEEKCTL_CHECK_CONFIG") != "" )
|
||||||
|
return;
|
||||||
|
|
||||||
|
local self = nodes[node];
|
||||||
|
|
||||||
|
for ( i in registered_pools )
|
||||||
|
{
|
||||||
|
local pool = registered_pools[i];
|
||||||
|
|
||||||
|
if ( node in pool$nodes )
|
||||||
|
Cluster::subscribe(pool$spec$topic);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ( self$node_type ) {
|
||||||
|
case NONE:
|
||||||
|
return;
|
||||||
|
case CONTROL:
|
||||||
|
break;
|
||||||
|
case LOGGER:
|
||||||
|
Cluster::subscribe(Cluster::logger_topic);
|
||||||
|
break;
|
||||||
|
case MANAGER:
|
||||||
|
Cluster::subscribe(Cluster::manager_topic);
|
||||||
|
break;
|
||||||
|
case PROXY:
|
||||||
|
Cluster::subscribe(Cluster::proxy_topic);
|
||||||
|
break;
|
||||||
|
case WORKER:
|
||||||
|
Cluster::subscribe(Cluster::worker_topic);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Reporter::error(fmt("Unhandled cluster node type: %s", self$node_type));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cluster::subscribe(nodeid_topic(Cluster::node_id()));
|
||||||
|
Cluster::subscribe(node_topic(node));
|
||||||
|
}
|
|
@ -1,2 +1,3 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
### NOTE: This file has been sorted with diff-sort.
|
### NOTE: This file has been sorted with diff-sort.
|
||||||
|
warning in <...>/setup-connections.zeek, line 1: deprecated script loaded from command line arguments "Remove in v9.1: Load base<...>/setup-subscriptions instead"
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
-./frameworks/cluster/nodes/proxy.zeek
|
-./frameworks/cluster/nodes/proxy.zeek
|
||||||
-./frameworks/cluster/nodes/worker.zeek
|
-./frameworks/cluster/nodes/worker.zeek
|
||||||
-./frameworks/cluster/setup-connections.zeek
|
-./frameworks/cluster/setup-connections.zeek
|
||||||
|
-./frameworks/cluster/setup-subscriptions.zeek
|
||||||
-./frameworks/cluster/supervisor.zeek
|
-./frameworks/cluster/supervisor.zeek
|
||||||
-./frameworks/intel/cluster.zeek
|
-./frameworks/intel/cluster.zeek
|
||||||
-./frameworks/netcontrol/cluster.zeek
|
-./frameworks/netcontrol/cluster.zeek
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue