.. _Creating the Virtuozzo Infrastructure Platform Cluster:

Creating the Virtuozzo Infrastructure Platform Cluster
------------------------------------------------------

To create the Virtuozzo Infrastructure Platform cluster means to create the cluster on one (first) node, then populate it with more nodes.

.. important:: To be able to create the cluster, you will need to assign a network with the storage traffic type to a node's network interface.

.. _Creating the Cluster on the First Node:

Creating the Cluster on the First Node
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Open the **INFRASTRUCTURE** > **Nodes** screen and click a node in the **UNASSIGNED** list.

   .. image:: ../../../images/stor_image22.png
      :align: center
      :class: align-center

#. On the node overview screen, click **Create cluster**.

#. In the **Cluster** field, type a name for the cluster. The name may only contain Latin letters (a-z, A-Z), numbers (0-9), underscores ("_") and dashes ("-").

   .. image:: ../../../images/stor_image23.png
      :align: center
      :class: align-center

#. Make sure a network interface that is connected to a network with the storage traffic type is selected from the **Storage interface** drop-down list.

   .. note:: If the network was not previously configured, click the cogwheel icon and, on the **Network Configuration** screen, assign a network with the storage traffic type to a network interface.

#. If required, enable data encryption. To do this, check the **Encryption** box (see :ref:`Managing Tier Encryption`) and proceed to create the cluster. Encryption will be enabled for all tiers by default. 

   To enable encryption for particular tiers, click the cogwheel icon to open the **Encryption Configuration** panel, select tiers to encrypt, and click **Done**.

   .. image:: ../../../images/stor_image23_1.png
      :align: center
      :class: align-center

   .. note:: You can later disable encryption for new chunk services (CS) on the **SETTINGS** > **Advanced settings** panel.

#. Click **New cluster** to have Virtuozzo Infrastructure Platform assign the roles to disks automatically. Alternatively, click **Advanced configuration** to assign the roles to each drive manually and tweak other settings.


You can monitor cluster creation progress in the **HEALTHY** list of the **INFRASTRUCTURE** > **Nodes** screen. The creation might take some time depending on the number of disks to be configured. Once the automatic configuration is complete, the cluster is created.

.. _Adding Nodes to Cluster:

Adding Nodes to Cluster
~~~~~~~~~~~~~~~~~~~~~~~

To add an unassigned node to a cluster, do the following:

1. On the **INFRASTRUCTURE** > **Nodes** screen, click an unassigned node.

   .. image:: ../../../images/stor_image24.png
      :align: center
      :class: align-center

2. On the node overview screen, click **Join cluster**.

3. Make sure a network interface that is connected to a network with the storage traffic type is selected from the **Storage interface** drop-down list.

   .. note:: If the network was not previously configured, click the cogwheel icon and, on the **Network Configuration** screen, assign a network with the storage traffic type to a network interface.

   .. image:: ../../../images/stor_image24_1.png
      :align: center
      :class: align-center

5. Click **Join cluster** to have Virtuozzo Infrastructure Platform assign the roles to disks automatically and add the node to the current cluster. Alternatively, click **Advanced configuration** to assign the roles to each drive manually (see :ref:`Assigning Disk Roles Manually`).

.. _Assigning Disk Roles Manually:

Assigning Disk Roles Manually
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you clicked **Advanced configuration** while creating a cluster or adding nodes to it, you will be taken to the list of drives on the node where you can manually assign roles to these drives. Do the following: 

#. On the **Join cluster** or **New cluster** panel, select a drive or check multiple drives in the list and click **Configure**. 

#. On the **Choose role** screen, select one of the following roles for the disk:

   .. image:: ../../../images/stor_image24_2.png
      :align: center
      :class: align-center

   - **Storage**. Use the disk to store chunks and run a chunk service on the node. From the **Caching and checksumming** drop-down list, select one of the following:

     - **Use SSD for caching and checksumming**. Available and recommended only for nodes with SSDs. 

     - **Enable checksumming** (default). Recommended for cold data as it provides better reliability.

     - **Disable checksumming**. Recommended for hot data as it provides better performance.

     Data caching improves cluster performance by placing the frequently accessed data on an SSD.

     Data checksumming generates checksums each time some data in the cluster is modified. When this data is then read, a new checksum is computed and compared with the old checksum. If the two are not identical, a read operation is performed again, thus providing better data reliability and integrity.

     If a node has an SSD, it will be automatically configured to keep checksums when you add a node to a cluster. This is the recommended setup. However, if a node does not have an SSD drive, checksums will be stored on a rotational disk by default. It means that this disk will have to handle double the I/O, because for each data read/write operation there will be a corresponding checksum read/write operation. For this reason, you may want to disable checksumming on nodes without SSDs to gain performance at the expense of checksums. This can be especially useful for hot data storage.

     .. note:: To add an SSD to a node that is already in the cluster (or replace a broken SSD), you will need to release the node from the cluster, attach the SSD, choose to join the node to the cluster again, and, while doing so, select **Use SSD for caching and checksumming** for each disk with the role **Storage**.

     With this role, you can also select a tier from the **Tier** drop-down list. To make better use of data redundancy, do not assign all the disks on a node to the same tier. Instead, make sure that each tier is evenly distributed across the cluster with only one disk per node assigned to it. For more information, see **Understanding Storage Tiers** in the *Virtuozzo Infrastructure Platform Installation Guide*.

     .. note:: If the disk contains old data that was not placed there by Virtuozzo Infrastructure Platform, the disk will not be considered suitable for use in Virtuozzo Infrastructure Platform.

   - **Metadata**. Use the disk to store metadata and run a metadata service on the node.

   - **Cache**. Use the disk to store write cache. This role is only for SSDs. To cache a specific storage tier, select it from the drop-down list. Otherwise, all tiers will be cached.

   - **Metadata+Cache**. A combination of two roles described above.

   - **Unassigned**. Remove the roles from the disk.

   .. note:: Both the System and Metadata roles can be assigned to the same disk with capacity of 100GB or higher---preferably to an SSD. Assigning both these roles to an HDD will result in mediocre performance suitable only for cold data (e.g., archiving).
   
#. Click **Done**.

#. Repeat steps 1 to 3 for every disk you want to be used in the Virtuozzo Infrastructure Platform cluster.

#. Click **NEW CLUSTER** or **JOIN CLUSTER**. On the **Configuration summary** screen, check the number of disks per each configuration category.

   .. image:: ../../../images/stor_image24_3.png
      :align: center
      :class: align-center

#. Click **PROCEED**. You can monitor disk configuration progress in the **HEALTHY** list of the **INFRASTRUCTURE** > **Nodes** screen.
