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:
  1. Create a cluster configuration file on one of the nodes in the cluster by executing the ccs command using the -h parameter to specify the node on which to create the file and the createcluster option to specify a name for the cluster:
    ccs -h host --createcluster clustername
    For example, the following command creates a configuration file on node-01.example.com named mycluster:
    ccs -h node-01.example.com --createcluster mycluster
    
    The cluster name cannot exceed 15 characters.
    If a cluster.conf file already exists on the host that you specify, executing this command will replace that existing file.
    If you want to create a cluster configuration file on your local system you can specify the -f option instead of the -h option. For information on creating the file locally, see Section 6.1.1, “Creating the Cluster Configuration File on a Local System”.
  2. 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
    For example, the following three commands add the nodes node-01.example.com, node-02.example.com, and node-03.example.com to the configuration file on node-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
    
    To view a list of the nodes that have been configured for a cluster, execute the following command:
    ccs -h host --lsnodes
    
    Example 6.1, “cluster.conf File After Adding Three Nodes” shows a cluster.conf configuration file after you have created the cluster mycluster that contains the nodes node-01.example.com, node-02.example.com, and node-03.example.com.

    Example 6.1. cluster.conf File After Adding Three Nodes

    
    <cluster name="mycluster" config_version="2">
       <clusternodes>
         <clusternode name="node-01.example.com" nodeid="1">
             <fence>
             </fence>
         </clusternode>
         <clusternode name="node-02.example.com" nodeid="2">
             <fence>
             </fence>
         </clusternode>
         <clusternode name="node-03.example.com" nodeid="3">
             <fence>
             </fence>
         </clusternode>
       </clusternodes>
       <fencedevices>
       </fencedevices>
       <rm>
       </rm>
    </cluster>
    

    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
    When you add a node, the ccs assigns 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
    To remove a node from a cluster, execute the following command:
    ccs -h host --rmnode node
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”.