注意

本文档适用于 Ceph 的开发版本。

Operating a Cluster

Running Ceph with systemd

在所有支持 systemd 的发行版中(CentOS 7、Fedora、Debian Jessie 8 及更高版本以及 SUSE),systemd 文件(而不是旧的 SysVinit 脚本)用于管理 Ceph 守护进程。因此,Ceph 守护进程的行为与其他可以通过 systemctl 命令控制的守护进程一样,如以下示例所示

sudo systemctl start ceph.target       # start all daemons
sudo systemctl status ceph-osd@12      # check status of osd.12

要列出节点上的所有 Ceph systemd 单元,请运行以下命令

sudo systemctl status ceph\*.service ceph\*.target

启动所有守护进程

要在 Ceph 节点上启动所有守护进程(无论其类型如何),请运行以下命令

sudo systemctl start ceph.target

停止所有守护进程

要在 Ceph 节点上停止所有守护进程(无论其类型如何),请运行以下命令

sudo systemctl stop ceph\*.service ceph\*.target

按类型启动所有守护进程

要在 Ceph 节点上启动特定类型的所有守护进程,请运行以下命令之一

sudo systemctl start ceph-osd.target
sudo systemctl start ceph-mon.target
sudo systemctl start ceph-mds.target

按类型停止所有守护进程

要在 Ceph 节点上停止特定类型的所有守护进程,请运行以下命令之一

sudo systemctl stop ceph-osd\*.service ceph-osd.target
sudo systemctl stop ceph-mon\*.service ceph-mon.target
sudo systemctl stop ceph-mds\*.service ceph-mds.target

启动守护进程

要在 Ceph 节点上启动特定的守护进程实例,请运行以下命令之一

sudo systemctl start ceph-osd@{id}
sudo systemctl start ceph-mon@{hostname}
sudo systemctl start ceph-mds@{hostname}

例如

sudo systemctl start ceph-osd@1
sudo systemctl start ceph-mon@ceph-server
sudo systemctl start ceph-mds@ceph-server

停止守护进程

要在 Ceph 节点上停止特定的守护进程实例,请运行以下命令之一

sudo systemctl stop ceph-osd@{id}
sudo systemctl stop ceph-mon@{hostname}
sudo systemctl stop ceph-mds@{hostname}

例如

sudo systemctl stop ceph-osd@1
sudo systemctl stop ceph-mon@ceph-server
sudo systemctl stop ceph-mds@ceph-server

Running Ceph with SysVinit

每次启动、重启或停止 Ceph 守护进程时,都必须指定至少一个选项和一个命令。同样,每次启动、重启或停止整个集群时,都必须指定至少一个选项和一个命令。在这两种情况下,您还可以指定守护进程类型或守护进程实例。

{commandline} [options] [commands] [daemons]

ceph 选项包括

选项

快捷方式

描述

--verbose

-v

使用详细日志记录。

--valgrind

N/A

(仅限开发和质量保证)使用 Valgrind 调试。

--allhosts

-a

ceph.conf 中列出的所有节点上执行。否则,它只在 localhost 上执行。

--restart

N/A

如果守护进程发生核心转储,则自动重新启动。

--norestart

N/A

如果守护进程发生核心转储,则不重新启动。

--conf

-c

使用备用配置文件。

ceph 命令包括

命令

描述

start

启动守护进程。

stop

停止守护进程。

forcestop

强制守护进程停止。与 kill -9 相同。

killall

杀死特定类型的所有守护进程。

cleanlogs

清理日志目录。

cleanalllogs

清理日志目录中的所有内容

[daemons] 选项允许 ceph 服务针对特定的守护进程类型执行子系统操作。守护进程类型包括

  • mon

  • osd

  • mds

由 Ceph 基金会为您呈现

Ceph 文档是由非营利性 Ceph 基金会 资助和托管的社区资源。如果您希望支持这项工作和我们的其他努力,请考虑 立即加入