Ceph is an open-source distributed file system with high reliability, automatic rebalancing, and flexible scalability. It supports object storage, block storage, and file storage. This topic describes how to deploy Ceph.
Ceph components
RADOS (Reliable Autonomic Distributed Object Store), known as the Ceph storage cluster, is the core component of the Ceph storage system. It features high availability, self-healing, and self-management, and consists of two core components: Ceph Monitor and Ceph OSD.
- Ceph Monitor: Monitors the cluster running status via maps, including the monitor map, OSD map, Placement Group (PG) map, and CRUSH map.
- Ceph OSD: Stores data and handles data replication, recovery, backfilling, and rebalancing. Ceph OSD also provides monitoring information to Ceph Monitors by checking the heartbeats of other OSD daemons. Typically, at least three Ceph OSDs are needed to achieve redundancy and high availability.
Prerequisites
- The ECS instance status is Running.
Practice planning
In this best practice, Ceph is deployed with products of the Volcano Engine platform, specifically ECS instances, VPC, and a public NAT gateway. Below is the planning for these relevant products.
Environment setup
Before deploying Ceph, you need to first set up an environment on the Volcano Engine platform, including creating a VPC, ECS instances, and a public NAT gateway. These are the prerequisites for starting your Ceph installation.
Create a VPC and subnet
- In the left-side navigation pane, click "Product and Services > VPC".
- In the top menu bar, select China (Beijing) .
- On the Virtual Private Cloud page, click "Create VPC".
- On the Create VPC page, configure the parameters of the VPC and subnet. For configuration details, see the table below.
- After the configuration is completed, click "Confirm".
Create an ECS instance
- In the left-side navigation pane, click "Product & Services > ECS".
- In the left navigation bar, select "Instances", set the region to China (Beijing) , and click "Create instance".
- On the Create Instances page, configure parameters as specified in the following table.
- After the basic configuration is completed, click "Next" for network and security configuration.
- On the Confirm page, confirm the parameter information. After the information is confirmed, follow the console guidance to review and confirm the agreement, and then click the "Buy now" button to create the instance.
- To deploy Ceph as described in this topic, you need to create four ECS instances. You can follow the guidance in the Practice planning to create them.
Create an EIP
- In the left-side navigation pane, click "Product and Service > EIP".
- On the Elastic IP page, click "Apply for EIP".
- Configure EIP parameters as specified below. After configuration, click "Agree and buy" to complete the creation process.
Create a public NAT gateway
- In the left-side navigation pane, click "Products and Services > Internet NAT Gateway".
- On the Internet NAT Gateway page, click "Create NAT Gateway". Configure parameters as specified below. After configuration, click "Confirm order".
- After the details are confirmed, follow the console guidance to review and confirm the agreements, and then click the "Buy now" button to complete creating the public NAT gateway.
- In the Internet NAT Gateway console, click the created "ceph-nat" to enter the public NAT gateway details page. Click "EIPs" and "Associate EIP" in sequence to associate the EIP ceph-eip.
- On the public NAT gateway details page, click "SNAT rules" and "Create SNAT rule" in sequence to add an SNAT entry.
Prepare for Ceph cluster installation
To speed up Ceph cluster deployment, we use Ansible for batch operations for most tasks in this practice. This helps reduce the time spent switching between nodes.
tip
Among the following operations, only the step "Change hostnames" requires you to log in to each node. All other can be performed on the deployment node ceph-node1.
Plan the hosts
Prepare the installation environment
Change hostnames
Configure the environment on ceph-node1
- Configure the file used for domain name resolution.
- Execute the vim /etc/hosts command to open the /etc/hosts file.
- Press i to enter the edit mode.
- Add the following content to the end of the /etc/hosts file, and replace the sample private IP address with your own private IP address.
- Press Esc, enter :wq, and then press Enter to save the modifications and close the file.
- Configure password-free login.
- SSH keys are stored in the ~/.ssh directory by default. You can specify a storage location for SSH keys as needed when configuring SSH keys. If you do not specify the storage location, press Enter when prompted for the storage location.
- Execute the following commands to install Ansible.
- Execute the vim /etc/ansible/hosts command to open the /etc/ansible/hosts file.
- Press i to enter the edit mode.
- Add the following content to the end of the /etc/ansible/hosts file.
- Press Esc, enter :wq, and then press Enter to save the modifications and close the file.
- Execute the following command to check whether all nodes support a password-free login.
- If the following output is displayed, the configuration succeeds.
-
- Execute the following command to copy the hosts file from the management machine to other remote hosts.
- If the following output is displayed on ceph-node1, ceph-node2, and ceph-node3, the configuration succeeds.
-
- Configure the Ceph package repository.
- Execute the vim /etc/yum.repos.d/ceph.repo command to open the /etc/yum.repos.d/ceph.repo file.
- Press i to enter the edit mode.
- Add the following content to the /etc/yum.repos.d/ceph.repo file.
- Press Esc, enter :wq, and then press Enter to save the modifications and close the file.
- Execute the following commands to copy the configuration changes to other nodes.
- If the following output is displayed on ceph-node1, ceph-node2, and ceph-node3, the configuration succeeds.
-
- Configure the /etc/yum.conf file to restrict the installable version of Ceph.
- Execute the vim /etc/yum.conf command to open the /etc/yum.conf file.
- Press i to enter the edit mode.
- Add the following content to the end of the /etc/yum.conf file.
- Press Esc, enter :wq, and then press Enter to save the modifications and close the file.
- Execute the following commands to copy the modified yum configuration to the other nodes.
Install and configure a Ceph cluster
- Execute the following command to install ceph-deploy.
- If the version information is displayed, the installation succeeds.
-
- Use ceph-deploy to install Ceph.
Note
Before this operation, make sure the EPEL repository is installed. Otherwise, an error occurs.
- Execute the following commands to install Ceph.
- If the following output is displayed, the installation succeeds.
-
- Execute the following command to view the Ceph version.
- The output is returned as follows:
-
- Deploy a RADOS storage cluster.
- Execute the following command to initialize the cluster.
- The output is returned as follows:
-
- Execute the cat ceph.conf command to view the configuration, as shown in the picture below:
-
- Execute the following commands to deploy mon nodes.
- The output is returned as follows:
-
- Execute the following commands to copy the admin configuration to other nodes.
- The output is returned as follows:
-
-
- ceph-mgr is a key feature mainly promoted in Ceph 12.2 and a component responsible for Ceph cluster management. Its goal is to achieve Ceph cluster management and provide a unified entry point for external systems.
- Execute the following commands to deploy ceph-mgr.
- The output is returned as follows:
-
- Ceph includes a native Dashboard feature, which allows you to view information about various basic statuses of a Ceph cluster.
- Execute the following commands to enable Dashboard.
- After the installation is completed, open a browser and in the address bar, input: http://<the EIP of the node where the Dashboard is located>:7000
-
- Execute the following commands to create OSDs on each node.
- Execute the ceph -s command to query the cluster status.
-
Create RBD
RBD (RADOS Block Device), a block storage, is the most stable and widely used storage type. An RBD can be mounted as a disk. It offers features including snapshots, multiple replicas, cloning, and consistency, with data stored in a striped manner across multiple OSDs in a Ceph cluster.
- Execute the following command to create a Ceph pool.
- If the following output is displayed, the creation succeeds.
-
- Execute the following commands to create image1 in the Ceph pool.
- If the following output is displayed, the creation succeeds.
-
- Execute the command rbd list <poolname> to view the image information in the Ceph pool.
- The output is returned as follows:
-
Use a client to mount the RBD to the local node
- Execute the following commands on ceph-node1 to install ceph-client.
- Execute the following commands in the ceph-client environment to mount the RBD to the local node.
- If the following output is displayed, the RBD is mounted.
-
Uninstall the cluster
Execute the following commands to uninstall the cluster.