Repository navigation
Operator
Daniel Carbone edited this page Nov 6, 2026
·
1 revision
$consul->Operator wraps Consul's Operator API for
cluster-level tasks: Raft, Autopilot, the gossip keyring and usage. Most calls need an operator ACL privilege.
[$raft, $err] = $consul->Operator->RaftGetConfiguration();
foreach ($raft->Servers as $server) {
echo "{$server->Node} {$server->Address} leader=" . var_export($server->Leader, true) . "\n";
}RaftRemovePeerByAddress(), RaftRemovePeerByID() and RaftLeaderTransfer() modify the Raft cluster. Use them with
care.
[$conf, $err] = $consul->Operator->AutopilotGetConfiguration();
var_dump($conf->CleanupDeadServers);
[$health, $err] = $consul->Operator->AutopilotServerHealth();
echo $health->Healthy ? 'healthy' : 'unhealthy', ", failure tolerance {$health->FailureTolerance}\n";AutopilotCASConfiguration() updates the configuration only if its ModifyIndex still matches.
The Keyring* methods manage the gossip encryption keys. They fail with an error if gossip encryption is not enabled
on the cluster.
The Area*, SegmentList, License* and AuditHash methods use Consul Enterprise endpoints. They return an error
against Consul CE.
Many Operator methods return only $err, or [$value, $err] without query metadata. See
Responses and Errors.