5.2. Managing Volumes using Heketi
Heketi provides a RESTful management interface which can be used to manage the lifecycle of Red Hat Gluster Storage volumes. With Heketi, cloud services like OpenStack Manila, Kubernetes, and OpenShift can dynamically provision Red Hat Gluster Storage volumes with any of the supported durability types. Heketi will automatically determine the location for bricks across the cluster, making sure to place bricks and its replicas across different failure domains. Heketi also supports any number of Red Hat Gluster Storage clusters, allowing cloud services to provide network file storage without being limited to a single Red Hat Gluster Storage cluster.
With Heketi, the administrator no longer manages or configures bricks, disks, or trusted storage pools. Heketi service will manage all hardware for the administrator, enabling it to allocate storage on demand. Any disks registered with Heketi must be provided in raw format, which will then be managed by it using LVM on the disks provided.
Note
- The replica 3 volume type is the default and the only supported volume type that can be created using Heketi.
Figure 5.1. Heketi Architecture
Heketi can be configured and executed using the CLI or the API. The sections ahead describe configuring Heketi using the CLI.
5.2.1. Prerequisites Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Heketi requires SSH access to the nodes that it will manage. Hence, ensure that the following requirements are met:
- SSH Access
- SSH user and public key must be setup on the node.
- SSH user must have password-less sudo.
- Must be able to run sudo commands from SSH. This requires disabling
requiretty
in the/etc/sudoers
file
- Start the glusterd service after Red Hat Gluster Storage is installed.
- Disks to be registered with Heketi must be in the raw format.
5.2.2. Installing Heketi Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Note
Heketi is supported only on Red Hat Enterprise Linux 7.
After installing Red Hat Gluster Storage 3.2, execute the following command to install the heketi-client:
yum install heketi-client
# yum install heketi-client
heketi-client has the binary for the heketi command line tool.
Execute the following command to install heketi:
yum install heketi
# yum install heketi
For more information about subscribing to the required channels and installing Red Hat Gluster Storage, see the Red Hat Gluster Storage Installation Guide.
5.2.3. Starting the Heketi Server Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Before starting the server, ensure that the following prerequisites are met:
- Generate the passphrase-less SSH keys for the nodes which are going to be part of the trusted storage pool by running the following command:
ssh-keygen -f /etc/heketi/heketi_key -t rsa -N ''
# ssh-keygen -f /etc/heketi/heketi_key -t rsa -N ''
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Change the owner and the group permissions for the heketi keys using the following command:
chown heketi:heketi /etc/heketi/heketi_key*
# chown heketi:heketi /etc/heketi/heketi_key*
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set up password-less SSH access between Heketi and the Red Hat Gluster Storage servers by running the following command:
ssh-copy-id -i /etc/heketi/heketi_key.pub root@server
# ssh-copy-id -i /etc/heketi/heketi_key.pub root@server
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Setup the heketi.json configuration file. The file is located in /etc/heketi/heketi.json. The configuration file has the information required to run the Heketi server. The config file must be in JSON format with the following settings:
- port: string, Heketi REST service port number
- use_auth: bool, Enable JWT Authentication
- jwt: map, JWT Authentication settings
- admin: map, Settings for the Heketi administrator
- key: string,
- user: map, Settings for the Heketi volume requests access user
- key: string, t
- glusterfs: map, Red Hat Gluster Storage settings
- executor: string, Determines the type of command executor to use. Possible values are:
- mock: Does not send any commands out to servers. Can be used for development and tests
- ssh: Sends commands to real systems over ssh
- db: string, Location of Heketi database
- sshexec: map, SSH configuration
- keyfile: string, File with private ssh key
- user: string, SSH user
Following is an example of the JSON file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
The location for the private SSH key that is created must be set in thekeyfile
setting of the configuration file, and the key should be readable by the heketi user.
5.2.3.1. Starting the Server Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
For Red Hat Enterprise Linux 7
- Enable heketi by executing the following command:
systemctl enable heketi
# systemctl enable heketi
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the Heketi server, by executing the following command:
systemctl start heketi
# systemctl start heketi
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To check the status of the Heketi server, execute the following command:
systemctl status heketi
# systemctl status heketi
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To check the logs, execute the following command:
journalctl -u heketi
# journalctl -u heketi
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
After Heketi is configured to manage the trusted storage pool, gluster commands should not be run on it, as this will make the heketidb inconsistent, leading to unexpected behaviors with Heketi.
5.2.3.2. Verifying the Configuration Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To verify if the server is running, execute the following step:
If Heketi is not setup with authentication, then use curl to verify the configuration:
curl http://<server:port>/hello
# curl http://<server:port>/hello
You can also verify the configuration using the heketi-cli when authentication is enabled:
heketi-cli --server http://<server:port> --user <user> --secret <secret> cluster list
# heketi-cli --server http://<server:port> --user <user> --secret <secret> cluster list
5.2.4. Setting up the Topology Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Setting up the topology allows Heketi to determine which nodes, disks, and clusters to use.
5.2.4.1. Prerequisites Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
You have to determine the node failure domains and clusters of nodes. Failure domains is a value given to a set of nodes which share the same switch, power supply, or anything else that would cause them to fail at the same time. Heketi uses this information to make sure that replicas are created across failure domains, thus providing cloud services volumes which are resilient to both data unavailability and data loss.
You have to determine which nodes would constitute a cluster. Heketi supports multiple Red Hat Gluster Storage clusters, which gives cloud services the option of specifying a set of clusters where a volume must be created. This provides cloud services and administrators the option of creating SSD, SAS, SATA, or any other type of cluster which provide a specific quality of service to users.
Note
Heketi does not have a mechanism today to study and build its database from an existing system. So, a new trusted storage pool has to be configured that can be used by Heketi.
5.2.4.2. Topology Setup Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The command line client loads the information about creating a cluster, adding nodes to that cluster, and then adding disks to each one of those nodes.This information is added into the topology file. To load a topology file with heketi-cli, execute the following command:
Note
A sample, formatted topology file (
topology-sample.json
) is installed with the ‘heketi-templates’ package in the /usr/share/heketi/
directory.
export HEKETI_CLI_SERVER=http://<heketi_server:port> heketi-cli load --json=<topology_file>
# export HEKETI_CLI_SERVER=http://<heketi_server:port>
# heketi-cli load --json=<topology_file>
Where
topology_file
is a file in JSON format describing the clusters, nodes, and disks to add to Heketi. The format of the file is as follows:
clusters: Array of clusters
- Each element on the array is a map which describes the cluster as follows
- nodes: Array of nodes in a clusterEach element on the array is a map which describes the node as follows
- node: Same as Node Add, except there is no need to supply the cluster ID.
- devices: Name of each disk to be added
- zone: The value represents failure domain on which the node exists.
For example:
- Topology file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Load the Heketi JSON file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Execute the following command to check the details of a particular node:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Execute the following command to check the details of the cluster:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To check the details of the device, execute the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.5. Creating a Volume Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
After Heketi is set up, you can use the CLI to create a volume.
- Execute the following command to check the various option for creating a volume:
heketi-cli volume create --size=<size in Gb> [options]
# heketi-cli volume create --size=<size in Gb> [options]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - For example: After setting up the topology file with two nodes on one failure domain, and two nodes in another failure domain, create a 100Gb volume using the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To check the details of the device, execute the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.6. Deleting a Volume Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To delete a volume, execute the following command:
heketi-cli volume delete <volname>
# heketi-cli volume delete <volname>
For example:
heketi-cli volume delete 0729fe8ce9cee6eac9ccf01f84dc88cc
$ heketi-cli volume delete 0729fe8ce9cee6eac9ccf01f84dc88cc
Volume 0729fe8ce9cee6eac9ccf01f84dc88cc deleted