base/frameworks/cluster/pools.zeek
- Cluster
Defines an interface for managing pools of cluster nodes. Pools are a useful way to distribute work or data among nodes within a cluster.
- Namespace
Cluster
- Imports
Summary
State Variables
A pool containing all the logger nodes of a cluster. |
|
The specification for |
|
A pool containing all the proxy nodes of a cluster. |
|
The specification for |
|
A pool containing all the worker nodes of a cluster. |
|
The specification for |
Types
Store state of a cluster within the context of a work pool. |
|
A pool specification. |
|
Functions
Retrieve the topic associated with the node mapped via Rendezvous hash of an arbitrary key. |
|
Registers and initializes a pool. |
|
Distributes log message topics among logger nodes via round-robin. |
|
Retrieve the topic associated with the node in a round-robin fashion. |
Detailed Interface
State Variables
- Cluster::logger_pool
- Type
- Default
{ spec=[topic=<uninitialized>, node_type=<uninitialized>, max_nodes=<uninitialized>, exclusive=F] nodes={ } node_list=[] hrw_pool=[sites={ }] rr_key_seq={ } alive_count=0 }
A pool containing all the logger nodes of a cluster. The pool’s node membership/availability is automatically maintained by the cluster framework.
- Cluster::logger_pool_spec
- Type
- Attributes
- Default
{ topic="zeek/cluster/pool/logger" node_type=Cluster::LOGGER max_nodes=<uninitialized> exclusive=F }
The specification for
Cluster::logger_pool
.
- Cluster::proxy_pool
- Type
- Default
{ spec=[topic=<uninitialized>, node_type=<uninitialized>, max_nodes=<uninitialized>, exclusive=F] nodes={ } node_list=[] hrw_pool=[sites={ }] rr_key_seq={ } alive_count=0 }
A pool containing all the proxy nodes of a cluster. The pool’s node membership/availability is automatically maintained by the cluster framework.
- Cluster::proxy_pool_spec
- Type
- Attributes
- Default
{ topic="zeek/cluster/pool/proxy" node_type=Cluster::PROXY max_nodes=<uninitialized> exclusive=F }
The specification for
Cluster::proxy_pool
.
- Cluster::worker_pool
- Type
- Default
{ spec=[topic=<uninitialized>, node_type=<uninitialized>, max_nodes=<uninitialized>, exclusive=F] nodes={ } node_list=[] hrw_pool=[sites={ }] rr_key_seq={ } alive_count=0 }
A pool containing all the worker nodes of a cluster. The pool’s node membership/availability is automatically maintained by the cluster framework.
- Cluster::worker_pool_spec
- Type
- Attributes
- Default
{ topic="zeek/cluster/pool/worker" node_type=Cluster::WORKER max_nodes=<uninitialized> exclusive=F }
The specification for
Cluster::worker_pool
.
Types
- Cluster::PoolNode
- Type
-
- name:
string
The node name (e.g. “manager”).
- alias:
string
An alias of name used to prevent hashing collisions when creating site_id.
- site_id:
count
A 32-bit unique identifier for the pool node, derived from name/alias.
- alive:
bool
&default
=F
&optional
Whether the node is currently alive and can receive work.
- name:
Store state of a cluster within the context of a work pool.
- Cluster::PoolNodeTable
- Type
table
[string
] ofCluster::PoolNode
- Cluster::PoolSpec
- Type
-
- topic:
string
A topic string that can be used to reach all nodes within a pool.
- node_type:
Cluster::NodeType
The type of nodes that are contained within the pool.
- max_nodes:
count
&optional
The maximum number of nodes that may belong to the pool. If not set, then all available nodes will be added to the pool, else the cluster framework will automatically limit the pool membership according to the threshold.
- exclusive:
bool
&default
=F
&optional
Whether the pool requires exclusive access to nodes. If true, then max_nodes nodes will not be assigned to any other pool. When using this flag, max_nodes must also be set.
- topic:
A pool specification.
Functions
- Cluster::hrw_topic
- Type
function
(pool:Cluster::Pool
, key:any
) :string
Retrieve the topic associated with the node mapped via Rendezvous hash of an arbitrary key.
- Parameters
pool – the pool of nodes to consider.
key – data used for input to the hashing function that will uniformly distribute keys among available nodes.
- Returns
a topic string associated with a cluster node that is alive or an empty string if nothing is alive.
- Cluster::register_pool
- Type
function
(spec:Cluster::PoolSpec
) :Cluster::Pool
Registers and initializes a pool.
- Cluster::rr_log_topic
-
Distributes log message topics among logger nodes via round-robin. This will be automatically assigned to
Broker::log_topic
ifCluster::enable_round_robin_logging
is enabled. If no logger nodes are active, then this will return the value ofBroker::default_log_topic
.
- Cluster::rr_topic
-
Retrieve the topic associated with the node in a round-robin fashion.
- Parameters
pool – the pool of nodes to consider.
key – an arbitrary string to identify the purpose for which you’re requesting the topic. e.g. consider using a name-spaced key like “Intel::cluster_rr_key” if you need to guarantee that a group of messages get distributed in a well-defined pattern without other messages being interleaved within the round-robin. Usually sharing the default key is fine for load-balancing purposes.
- Returns
a topic string associated with a cluster node that is alive, or an empty string if nothing is alive.