6.4. Creating and Modifying a Cluster
This section describes how to create, modify, and delete a skeleton cluster configuration with the
ccs command without fencing, failover domains, and HA services. Subsequent sections describe how to configure those parts of the configuration.
To create a skeleton cluster configuration file, first create and name the cluster and then add the nodes to the cluster, as in the following procedure:
- Create a cluster configuration file on one of the nodes in the cluster by executing the
ccscommand using the-hparameter to specify the node on which to create the file and thecreateclusteroption to specify a name for the cluster:ccs -h host --createcluster clustername
ccs -h host --createcluster clusternameCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example, the following command creates a configuration file onnode-01.example.comnamedmycluster:ccs -h node-01.example.com --createcluster mycluster
ccs -h node-01.example.com --createcluster myclusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow The cluster name cannot exceed 15 characters.If acluster.conffile already exists on the host that you specify, use the-ioption when executing this command to replace that existing file.If you want to create a cluster configuration file on your local system you can specify the-foption instead of the-hoption. For information on creating the file locally, see Section 6.1.1, “Creating the Cluster Configuration File on a Local System”. - To configure the nodes that the cluster contains, execute the following command for each node in the cluster. A node name can be up to 255 bytes in length.
ccs -h host --addnode node
ccs -h host --addnode nodeCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example, the following three commands add the nodesnode-01.example.com,node-02.example.com, andnode-03.example.comto the configuration file onnode-01.example.com:ccs -h node-01.example.com --addnode node-01.example.com ccs -h node-01.example.com --addnode node-02.example.com ccs -h node-01.example.com --addnode node-03.example.com
ccs -h node-01.example.com --addnode node-01.example.com ccs -h node-01.example.com --addnode node-02.example.com ccs -h node-01.example.com --addnode node-03.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow To view a list of the nodes that have been configured for a cluster, execute the following command:ccs -h host --lsnodes
ccs -h host --lsnodesCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example 6.1, “cluster.confFile After Adding Three Nodes” shows acluster.confconfiguration file after you have created the clustermyclusterthat contains the nodesnode-01.example.com,node-02.example.com, andnode-03.example.com.Example 6.1.
cluster.confFile After Adding Three NodesCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note
When you add a node to a cluster that uses UDPU transport, you must restart all nodes in the cluster for the change to take effect.When you add a node to the cluster, you can specify the number of votes the node contributes to determine whether there is a quorum. To set the number of votes for a cluster node, use the following command:ccs -h host --addnode host --votes votes
ccs -h host --addnode host --votes votesCopy to Clipboard Copied! Toggle word wrap Toggle overflow When you add a node, theccsassigns the node a unique integer that is used as the node identifier. If you want to specify the node identifier manually when creating a node, use the following command:ccs -h host --addnode host --nodeid nodeid
ccs -h host --addnode host --nodeid nodeidCopy to Clipboard Copied! Toggle word wrap Toggle overflow To remove a node from a cluster, execute the following command:ccs -h host --rmnode node
ccs -h host --rmnode nodeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
When you have finished configuring all of the components of your cluster, you will need to sync the cluster configuration file to all of the nodes, as described in Section 6.15, “Propagating the Configuration File to the Cluster Nodes”.