» Documentation

Cluster management

Create Cluster

Assuming stand-by nodes already installed, the cluster creation takes 3 steps:

Set cluster creation mode

Connect to any stand-by node and execute:

CREATE CLUSTER ENDPOINT ('mynode/ip:port'); 

The SQL command will set creating cluster mode and <endpoint('mynode/ip:port')> parameter sets the connections' Attributes for the particular node. All nodes will connect to the node using the endpoint attributes. Note: Use the same current nodes' listen port, or, the node needs to restart.

Define partition groups and nodes

Each partition can have up to 32 nodes. Define partitions and owning nodes SQL:

ADD PARTITION GROUP -- defines partition group 0 with up to 32 nodes
(
ADD ENDPOINT('mynode/IP:port'),   
ADD ENDPOINT('node2/IP:port'),
..,
ADD ENDPOINT('nodeN/IP:port')
);

ADD PARTITION GROUP -- defines partition group 1 with up to 32 nodes
(
ADD ENDPOINT('nodeM/IP:port'),   
..,
ADD ENDPOINT('nodeX/IP:port')
);
.... 

NOTE: endpoint('mynode/IP:port') is declared twice: CREATE CLUSTER/ADD ENDPOINT. It's important the endpoint in CREATE CLUSTER command is found in ADD PARTITION(...).

Commit cluster

To commit cluster creation execute SQL command:

COMMIT CLUSTER; 

The command will send cluster configuration to all nodes, set hash ranges and start failover monitoring. When cluster successfully created, each node creates, on nodes' install folder, cluster configuration file "cluster.config". The file can be examined to verify if configuration is correct. Additionally to view all nodes and partitions, execute:

SELECT * FROM SYSTEM.SYSINSTANCES 

All 3 steps can be combined into a single SQL batch statement, for example:

CREATE CLUSTER ENDPOINT('mynode/ip:port'); 
GO;
ADD PARTITION GROUP 
(
ADD ENDPOINT('mynode/IP:port'),   
ADD ENDPOINT('node2/IP:port'),
);
GO;
ADD PARTITION GROUP 
(
ADD ENDPOINT('nodeM/IP:port'),   
ADD ENDPOINT('nodeX/IP:port')
);
GO;
COMMIT CLUSTER; 

Alter cluster

Alter cluster, when add new partition(s), split existing partition(s) or add/remove node(s). The command does not block running transactions.

To set cluster change mode, connect to any node and execute:

ALTER CLUSTER; 

Add partition group

To add new partition group, use SQL:

ADD PARTITION GROUP REPARTITION WITH 0 
(      
ADD ENDPOINT('nodex:port')
...    
,ADD ENDPOINT('nodeZ:port')
); 

ADD PARTITION GROUP... will create a new partition. ...REPARTITION WITH 0 indicates that partition (0) will split data with the new partition, So both partitions' hash range will change.

Split partition

Splitting partition creates a new partition out of the existing one. Half nodes will remain on existing partition, and other half will be moved to the new partition. The splitting partition must have at least 2 nodes, so first node remains on existing partition And the second will be assigned to the new partition. Hence, we recommend split the partitions With a minimum 4 nodes, such each partition will have at least 2 nodes and can failover. The split partition command is instant, no data movement is involved. The nodes will not "see" the old data; while background cleanup completes. Consider splitting command as the cluster performance boost for the price of the lower availability.

The SQL command bellow splits the partition group {0}. To identify partitions or nodes execute: select * from system.sysinstances

SPLIT PARTITION GROUP 0 

Alter partition

To remove or add node(s) from/to partition group, execute alter specified partition group command. The parameters to alter partition will be either drop existing or add new node identified by endpoint.

Add node(s)

ALTER PARTITION GROUP 0 
(      
   ADD ENDPOINT('mynodeA:1000'),-- stand by node 
   ...,
   ADD ENDPOINT('mynodeX:1001')-- stand by node
); 

Drop node(s)

ALTER PARTITION GROUP 0 
(      
   DROP ENDPOINT('mynodeA:1000'),-- existing node in partition group {0}
   ...,
   DROP ENDPOINT('mynodeX:1001')-- existing node in partition group {0}
); 

Add/Drop node(s) single command

ALTER PARTITION GROUP 0 
(      
   ADD ENDPOINT('mynodeA:1000'),-- stand-by node
   ...,
   DROP ENDPOINT('mynodeX:1001')-- existing node in partition group {0}
); 

Commit cluster

To finalize cluster change execute COMMIT CLUSTER SQL command. Alter cluster, change and commit can be combined to a single SQL batch, for example:

ALTER CLUSTER;
GO;
ALTER PARTITION GROUP 0 
(      
   DROP ENDPOINT('mynode1:999'), -- existing node 
   ADD ENDPOINT('mynode2:1000'),-- stand by node 
   ADD ENDPOINT('mynode3:1001')-- stand by node
); 
GO;
COMMIT CLUSTER; 

Step by step examples