One command to restore (better read why ceph service can be restored with one command)


systemctl isolate multi-user.target

Copy the code

Version information

Applicable to CepH 15 + Octopus, and CepHADM is automatically deployed

Ceph container service restored

The premise condition

Know that most fSID files are not missing

Install cephadm

The full steps can be found on the cephadm website, or other ceph blogs of cephadm that rely on PYTHon36


curl --silent --remote-name --location https://github.com/ceph/ceph/raw/octopus/src/cephadm/cephadm

chmod +x cephadm

./cephadm --help

./cephadm add-repo --release octopus
./cephadm install

Copy the code

View ceph service dependencies

Systemctl list - dependencies ceph. Target ceph. Target low └ ─ aa7de1c ceph - 2-497 - a - 11 eb - b926 - fa163e717f07. Target is low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@alertmanager.host-192-168-141-20.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@crash.host-192-168-141-20.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@grafana.host-192-168-141-20.service low ├ ─ [email protected]_fs.host-192-168-141-20.mcwtpb. Service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@mgr.host-192-168-141-20.fsdiay.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@mon.host-192-168-141-20.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@node-exporter.host-192-168-141-20.service low ├ ─ [email protected] low ├ ─ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@prometheus.host-192-168-141-20.service Ensure that there is as little as one cluster configuration in the whole ceph. If unnecessary CEPh services exist, you can use cephadm to delete themCopy the code

(Optional) Deleting redundant clusters

The blogger did not know how to use cephadm bootstrap at first, and executed the cephadm bootstrap directive several times, creating multiple CepH services and keeping only one cluster


# rm--cluster will be deleted
# /var/lib/ceph/<fsid>
# /var/log/ceph/<fsid>
# /etc/systemd/system/*<fsid>*
# And remove excess running Docker containers
cephadm rm-cluster --fsid dc05693c-48bb-11eb-84da-fa163e717f07 --force

You can confirm it after deleting it
ls  /var/lib/ceph/
2aa7de1c-497a-11eb-b926-fa163e717f07

ls  /var/log/ceph/ 2aa7de1c-497a-11eB-b926-fa163e717f07 ls /etc/systemd/system/... Docker PS...Copy the code

A command to restore ***


systemctl isolate multi-user.target 

Copy the code

Systemctl Restore command interpretation

What is SystemCTL Taget and want

Systemctl contains the following concepts: systemctl service systemctl Unit Systemctl want Systemctl target Multiple services comprise a unit unit that can be used by other units The dependencies form unit_1 target UNIT_2 and then the specific want relationship is stored in the corresponding wants directory

Ceph startup interpretation

The systemCTL ISOLATE multi-user.target switches the working mode of the Linux operating system. The server runs in multi-user mode with no interface. Cephadm Bootstrap cluster In the/etc/systemd/system installation since the launch of ceph cluster service under the cat/etc/systemd/system/ceph. Target [Unit] Description = All ceph clusters and Services [Install] WantedBy=multi-user. Target *** file meaning that ceph. Target depends on multi-user startup target so we reload multi-user mode at the same time. Ceph cluster services will also be reloaded. / etc/systemd/system/ceph. Target will go through the corresponding wants directory - > ls/etc/systemd/system/ceph. Target. Wants Cceph-2aa7de1c-497a-11eb-b926-fa163e717f07. target: cceph-2AA7DE1c-497a-11EB-b926-FA163e717f07. target: cceph-2AA7DE1c-497a-11EB-b926-FA163e717f07 --> ls /etc/systemd/system/ceph-2aa7de1c-497a-11eb-b926-fa163e717f07.target.wants ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@alertmanager.host-192-168-141-20.service ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@mon.host-192-168-141-20.service ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@crash.host-192-168-141-20.service ..................Copy the code

We can also directly view all the services that ceph. Target will start by relying on the search command

Systemctl list - dependencies ceph. Target - > ceph. Target low └ ─ aa7de1c ceph - 2-497 - a - 11 eb - b926 - fa163e717f07. Target is low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@alertmanager.host-192-168-141-20.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@crash.host-192-168-141-20.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@grafana.host-192-168-141-20.service low ├ ─ [email protected]_fs.host-192-168-141-20.mcwtpb. Service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@mgr.host-192-168-141-20.fsdiay.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@mon.host-192-168-141-20.service low ├ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@node-exporter.host-192-168-141-20.service low ├ ─ [email protected] low └ ─ ceph-2aa7de1c-497a-11eb-b926-fa163e717f07@prometheus.host-192-168-141-20.serviceCopy the code