The Nodes namespace includes methods for handling cluster operations. These are available for Manticore Search 3.4 and higher.
Create a new cluster.
The cluster parameter is required, as it specifies the name of the cluster.
The body parameter is optional and may contain path as an alternative folder for storing replication metadata and nodes for the list of servers that will join the cluster.
$params = [
'cluster' => 'mycluster',
'body' => [
'path' => '/var/data/click_query/',
'nodes' => 'clicks_mirror1:9312,clicks_mirror2:9312,clicks_mirror3:9312',
]
];
$response = $client->cluster()->create($params);
The cluster parameter is required, as it specifies the name of the cluster.
body parameters:
-
operation- mandatory, can be: * add - add a table to the cluster * drop - remove a table from the cluster * update - trigger nodes in the cluster to update the rejoin nodes list in the event of a cluster restart -
table- mandatory for add/drop operations, specifies the table name that is added or removed from the cluster$params = [ 'cluster' => 'mycluster', 'body' => [ 'operation' => 'add', 'table' => 'newtable' ] ]; $response = $client->cluster()->alter($params); $params = [ 'cluster' => 'mycluster', 'body' => [ 'operation' => 'drop', 'table' => 'newtable' ] ]; $response = $client->cluster->alter($params); $params = [ 'cluster' => 'mycluster', 'body' => [ 'operation' => 'update', ] ]; $response = $client->cluster()->alter($params);
The cluster parameter is required, as it specifies the name of the cluster.
$params = [
'cluster' => 'mycluster',
'body' => [
]
];
$response = $client->cluster()->delete($params);
The cluster parameter is required, as it specifies the name of the cluster to join.
There are two syntax options for the body parameter:
-
Simple version - specify the address of one of the cluster's nodes using the
nodeparameter -
Advanced version - set an alternative
pathfor replication metadata and provide the list of all nodes in the cluster using thenodesparameter$params = [ 'cluster' => 'mycluster', 'body' => [ 'node' => 'address:port' ] ]; $response = $client->cluster->join($params); $params = [ 'cluster' => 'mycluster', 'body' => [ 'path' => '/var/data/click_query/', 'nodes' => 'clicks_mirror1:9312;clicks_mirror2:9312;clicks_mirror3:9312', ] ]; $response = $client->cluster()->join($params);
Set a Galera option to the cluster.
$params = [
'cluster' => 'mycluster',
'body' => [
'variable'=> [
'name' => 'pc.bootstrap',
'value'=>'1'
]
]
];
$response = $client->cluster()->set($params);