mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
Implement minimal supervised cluster configuration
More aspects of the cluster configuration to get fleshed out later, but a basic cluster like one would use for a live deployment can now be instantiated and run under supervision. The new clusterized-pcap-processing supervisor mode is also not done yet.
This commit is contained in:
parent
25a8ba99fa
commit
29f386e388
12 changed files with 390 additions and 91 deletions
|
@ -18,7 +18,12 @@ redef Broker::log_topic = Cluster::rr_log_topic;
|
|||
# Loading the cluster framework requires that a script by this name exists
|
||||
# somewhere in the ZEEKPATH. The only thing in the file should be the
|
||||
# cluster definition in the :zeek:id:`Cluster::nodes` variable.
|
||||
|
||||
@if ( ! Supervisor::__init_cluster() )
|
||||
# When running a supervised cluster, Cluster::nodes is instead populated
|
||||
# from the internal C++-layer directly via the above BIF.
|
||||
@load cluster-layout
|
||||
@endif
|
||||
|
||||
@if ( Cluster::node in Cluster::nodes )
|
||||
|
||||
|
|
|
@ -287,7 +287,13 @@ function is_enabled(): bool
|
|||
|
||||
function local_node_type(): NodeType
|
||||
{
|
||||
return is_enabled() ? nodes[node]$node_type : NONE;
|
||||
if ( ! is_enabled() )
|
||||
return NONE;
|
||||
|
||||
if ( node !in nodes )
|
||||
return NONE;
|
||||
|
||||
return nodes[node]$node_type;
|
||||
}
|
||||
|
||||
function node_topic(name: string): string
|
||||
|
|
|
@ -4,14 +4,32 @@
|
|||
module Supervisor;
|
||||
|
||||
export {
|
||||
type ClusterRole: enum {
|
||||
NONE,
|
||||
LOGGER,
|
||||
MANAGER,
|
||||
PROXY,
|
||||
WORKER,
|
||||
};
|
||||
|
||||
type ClusterEndpoint: record {
|
||||
role: ClusterRole;
|
||||
host: addr;
|
||||
p: port;
|
||||
interface: string &optional;
|
||||
};
|
||||
|
||||
type Node: record {
|
||||
# TODO: add proper config fields
|
||||
name: string;
|
||||
interface: string &optional;
|
||||
cluster: table[string] of ClusterEndpoint &default=table();
|
||||
|
||||
# TODO: separate node config fields from status fields ?
|
||||
# TODO: add more status fields ?
|
||||
pid: count &optional;
|
||||
};
|
||||
|
||||
type Status: record {
|
||||
# TODO: add more status fields ?
|
||||
nodes: table[string] of Node;
|
||||
};
|
||||
|
||||
|
|
|
@ -54,17 +54,17 @@ function Supervisor::status(nodes: string): Status
|
|||
return Supervisor::__status(nodes);
|
||||
}
|
||||
|
||||
function create(node: Node): string
|
||||
function Supervisor::create(node: Node): string
|
||||
{
|
||||
return Supervisor::__create(node);
|
||||
}
|
||||
|
||||
function destroy(nodes: string): bool
|
||||
function Supervisor::destroy(nodes: string): bool
|
||||
{
|
||||
return Supervisor::__destroy(nodes);
|
||||
}
|
||||
|
||||
function restart(nodes: string): bool
|
||||
function Supervisor::restart(nodes: string): bool
|
||||
{
|
||||
return Supervisor::__restart(nodes);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue