Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 3. Administering Ceph Clusters That Run in Containers
This chapter describes basic administration tasks to perform on Ceph clusters that run in containers, such as:
3.1. Starting, Stopping, and Restarting Ceph Daemons That Run in Containers Copier lienLien copié sur presse-papiers!
Use the systemctl command start, stop, or restart Ceph daemons that run in containers.
Procedure
To start, stop, or restart a Ceph daemon running in a container, run a
systemctlcommand asrootcomposed in the following format:systemctl action ceph-daemon@IDWhere:
-
action is the action to perform;
start,stop, orrestart -
daemon is the daemon;
osd,mon,mds, orrgw ID is either
-
The short host name where the
ceph-mon,ceph-mds, orceph-rgwdaemons are running -
The ID of the
ceph-osddaemon if it was deployed theosd_scenarioparameter set tolvm -
The device name that the
ceph-osddaemon uses if it was deployed with theosd_scenarioparameter set tocollocatedornon-collocated
-
The short host name where the
For example, to restart a
ceph-osddaemon with the IDosd01:# systemctl restart ceph-osd@osd01To start a
ceph-mondemon that runs on theceph-monitor01host:# systemctl start ceph-mon@ceph-monitor01To stop a
ceph-rgwdaemon that runs on theceph-rgw01host:# systemctl stop ceph-radosgw@ceph-rgw01-
action is the action to perform;
Verify that the action was completed successfully.
systemctl status ceph-daemon@_IDFor example:
# systemctl status ceph-mon@ceph-monitor01
Additional Resources
- The Running Ceph as a systemd Service section in the Administration Guide for Red Hat Ceph Storage 3.
3.2. Viewing Log Files of Ceph Daemons That Run in Containers Copier lienLien copié sur presse-papiers!
Use the journald daemon from the container host to view a log file of a Ceph daemon from a container.
Procedure
To view the entire Ceph log file, run a
journalctlcommand asrootcomposed in the following format:journalctl -u ceph-daemon@IDWhere:
-
daemon is the Ceph daemon;
osd,mon, orrgw ID is either
-
The short host name where the
ceph-mon,ceph-mds, orceph-rgwdaemons are running -
The ID of the
ceph-osddaemon if it was deployed theosd_scenarioparameter set tolvm -
The device name that the
ceph-osddaemon uses if it was deployed with theosd_scenarioparameter set tocollocatedornon-collocated
-
The short host name where the
For example, to view the entire log for the
ceph-osddaemon with the IDosd01:# journalctl -u ceph-osd@osd01-
daemon is the Ceph daemon;
To show only the recent journal entries, use the
-foption.journalctl -fu ceph-daemon@IDFor example, to view only recent journal entries for the
ceph-mondaemon that runs on theceph-monitor01host:# journalctl -fu ceph-mon@ceph-monitor01
You can also use the sosreport utility to view the journald logs. For more details about SOS reports, see the What is a sosreport and how to create one in Red Hat Enterprise Linux 4.6 and later? solution on the Red Hat Customer Portal.
Additional Resources
-
The
journalctl(1)manual page
3.3. Adding a Ceph OSD using the command-line interface Copier lienLien copié sur presse-papiers!
Here is the high-level workflow for manually adding an OSD to a Red Hat Ceph Storage:
-
Install the
ceph-osdpackage and create a new OSD instance - Prepare and mount the OSD data and journal drives
- Add the new OSD node to the CRUSH map
- Update the owner and group permissions
-
Enable and start the
ceph-osddaemon
The ceph-disk command is deprecated. The ceph-volume command is now the preferred method for deploying OSDs from the command-line interface. Currently, the ceph-volume command only supports the lvm plugin. Red Hat will provide examples throughout this guide using both commands as a reference, allowing time for storage administrators to convert any custom scripts that rely on ceph-disk to ceph-volume instead.
See the Red Hat Ceph Storage Administration Guide, for more information on using the ceph-volume command.
For custom storage cluster names, use the --cluster $CLUSTER_NAME option with the ceph and ceph-osd commands.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Review the Requirements for Installing Red Hat Ceph Storage chapter in the Installation Guide for Red Hat Enterprise Linux or Ubuntu.
-
Having
rootaccess to the new nodes.
Procedure
Enable the Red Hat Ceph Storage 3 OSD software repository.
Red Hat Enterprise Linux
[root@osd ~]# subscription-manager repos --enable=rhel-7-server-rhceph-3-osd- els-rpms-
Create the
/etc/ceph/directory: - On the new OSD node, copy the Ceph administration keyring and configuration files from one of the Ceph Monitor nodes:
Install the
ceph-osdpackage on the new Ceph OSD node:Red Hat Enterprise Linux
[root@osd ~]# yum install ceph-osdDecide if you want to collocate a journal or use a dedicated journal for the new OSDs.
NoteThe
--filestoreoption is required.For OSDs with a collocated journal:
Syntax
[root@osd ~]# docker exec $CONTAINER_ID ceph-disk --setuser ceph --setgroup ceph prepare --filestore /dev/$DEVICE_NAMEExample:
[root@osd ~]# docker exec ceph-osd-osd1 ceph-disk --setuser ceph --setgroup ceph prepare --filestore /dev/sdaFor OSDs with a dedicated journal:
Syntax
[root@osd ~]# docker exec $CONTAINER_ID ceph-disk --setuser ceph --setgroup ceph prepare --filestore /dev/$DEVICE_NAME /dev/$JOURNAL_DEVICE_NAMEor
[root@osd ~]# docker exec $CONTAINER_ID ceph-volume lvm prepare --filestore --data /dev/$DEVICE_NAME --journal /dev/$JOURNAL_DEVICE_NAMEExamples
[root@osd ~]# docker exec ceph-osd-osd1 ceph-disk --setuser ceph --setgroup ceph prepare --filestore /dev/sda /dev/sdb[root@osd ~]# docker exec ceph-osd-osd1 ceph-volume lvm prepare --filestore --data /dev/vg00/lvol1 --journal /dev/sdb
Set the
noupoption:[root@osd ~]# ceph osd set noupActivate the new OSD:
Syntax
[root@osd ~]# docker exec $CONTAINER_ID ceph-disk activate /dev/$DEVICE_NAMEor
[root@osd ~]# docker exec $CONTAINER_ID ceph-volume lvm activate --filestore $OSD_ID $OSD_FSIDExample
[root@osd ~]# docker exec ceph-osd-osd1 ceph-disk activate /dev/sda[root@osd ~]# docker exec ceph-osd-osd1 ceph-volume lvm activate --filestore 0 6cc43680-4f6e-4feb-92ff-9c7ba204120eAdd the OSD to the CRUSH map:
Syntax
ceph osd crush add $OSD_ID $WEIGHT [$BUCKET_TYPE=$BUCKET_NAME ...]Example
[root@osd ~]# ceph osd crush add 4 1 host=node4NoteIf you specify more than one bucket, the command places the OSD into the most specific bucket out of those you specified, and it moves the bucket underneath any other buckets you specified.
NoteYou can also edit the CRUSH map manually. See the Editing a CRUSH map section in the Storage Strategies guide for Red Hat Ceph Storage 3.
ImportantIf you specify only the root bucket, then the OSD attaches directly to the root, but the CRUSH rules expect OSDs to be inside of the host bucket.
Unset the
noupoption:[root@osd ~]# ceph osd unset noupUpdate the owner and group permissions for the newly created directories:
Syntax
chown -R $OWNER:$GROUP $PATH_TO_DIRECTORYExample
[root@osd ~]# chown -R ceph:ceph /var/lib/ceph/osd [root@osd ~]# chown -R ceph:ceph /var/log/ceph [root@osd ~]# chown -R ceph:ceph /var/run/ceph [root@osd ~]# chown -R ceph:ceph /etc/cephIf you use clusters with custom names, then add the following line to the appropriate file:
Red Hat Enterprise Linux
[root@osd ~]# echo "CLUSTER=$CLUSTER_NAME" >> /etc/sysconfig/cephReplace
$CLUSTER_NAMEwith the custom cluster name.To ensure that the new OSD is
upand ready to receive data, enable and start the OSD service:Syntax
systemctl enable ceph-osd@$OSD_ID systemctl start ceph-osd@$OSD_IDExample
[root@osd ~]# systemctl enable ceph-osd@4 [root@osd ~]# systemctl start ceph-osd@4
3.4. Removing a Ceph OSD using the command-line interface Copier lienLien copié sur presse-papiers!
Removing an OSD from a storage cluster involves updating the cluster map, removing its authentication key, removing the OSD from the OSD map, and removing the OSD from the ceph.conf file. If the node has multiple drives, you might need to remove an OSD for each drive by repeating this procedure.
Prerequisites
- A running Red Hat Ceph Storage cluster.
-
Enough available OSDs so that the storage cluster is not at its
near fullratio. -
Having
rootaccess to the OSD node.
Procedure
Disable and stop the OSD service:
Syntax
systemctl disable ceph-osd@$DEVICE_NAME systemctl stop ceph-osd@$DEVICE_NAMEExample
[root@osd ~]# systemctl disable ceph-osd@sdb [root@osd ~]# systemctl stop ceph-osd@sdbOnce the OSD is stopped, it is
down.Remove the OSD from the storage cluster:
Syntax
ceph osd out $DEVICE_NAMEExample
[root@osd ~]# ceph osd out sdbImportantOnce the OSD is out, Ceph will start rebalancing and copying data to other OSDs in the storage cluster. Red Hat recommends waiting until the storage cluster becomes
active+cleanbefore proceeding to the next step. To observe the data migration, run the following command:[root@monitor ~]# ceph -wRemove the OSD from the CRUSH map so that it no longer receives data.
Syntax
ceph osd crush remove $OSD_NAMEExample
[root@osd ~]# ceph osd crush remove osd.4NoteYou can also decompile the CRUSH map, remove the OSD from the device list, remove the device as an item in the host bucket or remove the host bucket. If it is in the CRUSH map and you intend to remove the host, recompile the map and set it. See the Storage Strategies Guide for details.
Remove the OSD authentication key:
Syntax
ceph auth del osd.$DEVICE_NAMEExample
[root@osd ~]# ceph auth del osd.sdbRemove the OSD:
Syntax
ceph osd rm $DEVICE_NAMEExample
[root@osd ~]# ceph osd rm sdbEdit the storage cluster’s configuration file, by default
/etc/ceph.conf, and remove the OSD entry, if it exists:Example
[osd.4] host = $HOST_NAME-
Remove the reference to the OSD in the
/etc/fstabfile, if the OSD was added manually. Copy the updated configuration file to the
/etc/ceph/directory of all other nodes in the storage cluster.Syntax
scp /etc/ceph/$CLUSTER_NAME.conf $USER_NAME@$HOST_NAME:/etc/ceph/Example
[root@osd ~]# scp /etc/ceph/ceph.conf root@node4:/etc/ceph/
3.5. Replacing an OSD drive while retaining the OSD ID Copier lienLien copié sur presse-papiers!
When replacing a failed OSD drive, you can keep the original OSD ID and CRUSH map entry.
The ceph-volume lvm commands defaults to BlueStore for OSDs. To use FileStore OSDs, then use the --filestore, --data and --journal options.
See the Preparing the OSD Data and Journal Drives section for more details.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- A failed disk.
Procedure
Destroy the OSD:
ceph osd destroy $OSD_ID --yes-i-really-mean-itExample
$ ceph osd destroy 1 --yes-i-really-mean-itOptionally, if the replacement disk was used previously, then you need to
zapthe disk:docker exec $CONTAINER_ID ceph-volume lvm zap $DEVICEExample
$ docker exec ceph-osd-osd1 ceph-volume lvm zap /dev/sdbCreate the new OSD with the existing OSD ID:
docker exec $CONTAINER_ID ceph-volume lvm create --osd-id $OSD_ID --data $DEVICEExample
$ docker exec ceph-osd-osd1 ceph-volume lvm create --osd-id 1 --data /dev/sdb
3.6. Purging Clusters Deployed by Ansible Copier lienLien copié sur presse-papiers!
If you no longer want to use a Ceph cluster, use the purge-docker-cluster.yml playbook to purge the cluster. Purging a cluster is also useful when the installation process failed and you want to start over.
After purging a Ceph cluster, all data on the OSDs are lost.
Prerequisites
-
Ensure that the
/var/log/ansible.logfile is writable.
Procedure
Use the following commands from the Ansible administration node.
As the
rootuser, navigate to the/usr/share/ceph-ansible/directory.[root@admin ~]# cd /usr/share/ceph-ansibleCopy the
purge-docker-cluster.ymlplaybook from the/usr/share/infrastructure-playbooks/directory to the current directory:[root@admin ceph-ansible]# cp infrastructure-playbooks/purge-docker-cluster.yml .As the Ansible user, use the
purge-docker-cluster.ymlplaybook to purge the Ceph cluster.To remove all packages, containers, configuration files, and all the data created by the
ceph-ansibleplaybook:[user@admin ceph-ansible]$ ansible-playbook purge-docker-cluster.ymlTo specify a different inventory file than the default one (
/etc/ansible/hosts), use-iparameter:ansible-playbook purge-docker-cluster.yml -i inventory-fileReplace inventory-file with the path to the inventory file.
For example:
[user@admin ceph-ansible]$ ansible-playbook purge-docker-cluster.yml -i ~/ansible/hostsTo skip the removal of the Ceph container image, use the
--skip-tags=”remove_img”option:[user@admin ceph-ansible]$ ansible-playbook --skip-tags="remove_img" purge-docker-cluster.ymlTo skip the removal of the packages that were installed during the installation, use the
--skip-tags=”with_pkg”option:[user@admin ceph-ansible]$ ansible-playbook --skip-tags="with_pkg" purge-docker-cluster.yml