ceph命令系列(二):Ceph集群启动/停止/重启命令

Ceph-deploy命令安装好集群后,可以操作其维护命令。我安装的版本是luminous(12.2.11),ceph脚本对应/usr/bin/ceph文件,这个版本已经没有/etc/init.d/ceph [option] [start/stop/restart]了。centos使用systemctl,ubuntu使用service命令来操作ceph服务。 

$ ceph --version
ceph version 12.2.11 (26dc3775efc7bb286a1d6d66faee0ba30ea23eee) luminous (stable)


一、查看ceph 集群状态
1.ssh 登陆集群的任何一台MON主机
2.执行 sudo ceph health [detail] 、sudo ceph -s 命令查看
 
二、启动、停止、重启、查看MON进程
登陆到monitor节点,执行如下命令
sudo systemctl [start/stop/restart/status] ceph-mon@mon‘sid.service,例如:我的monitor id为node1

$ systemctl status [email protected][email protected] - Ceph cluster monitor daemon
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-07-10 02:16:00 ; 10min ago
 Main PID: 3607 (ceph-mon)
   CGroup: /system.slice/system-ceph\x2dmon.slice/[email protected]
           └─3607 /usr/bin/ceph-mon -f --cluster ceph --id node1 --setuser ce...

设置ceph-osd随Linux 系统自动启动

$ systemctl enable [email protected]

查看mon节点上所有启动的ceph服务,命令:systemctl list-units --type=service|grep ceph

$ systemctl list-units --type=service|grep ceph
  [email protected]             loaded active running Ceph cluster manager daemon
  [email protected]             loaded active running Ceph cluster monitor daemon
  [email protected]     loaded active running Ceph rados gateway

 查看节点上所有自动启动的ceph服务,命令:systemctl list-unit-files|grep enabled|grep ceph

$  systemctl list-unit-files|grep enabled|grep ceph
[email protected]                             enabled
ceph-mds.target                               enabled
ceph-mgr.target                               enabled
ceph-mon.target                               enabled
ceph-osd.target                               enabled
ceph-radosgw.target                           enabled
ceph.target                                   enabled


 
三、启动、停止、重启、查看OSD所有和单个进程
1)登陆到OSD 节点,对服务器上的所有OSD操作
sudo systemctl [start/stop/restart/status] ceph-osd@* or eph-osd@osd_id.service

$ systemctl status ceph-osd@*.service
● [email protected] - Ceph object storage daemon osd.node1
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; disabled; vendor preset: disabled)
   Active: inactive (dead)

 



2.如上把@* 替换为OSD的ID 如@0,即可执行对应ID的 OSD操作。这里的osd id的值 是0,不是hostname了,例如:

sudo systemctl [start/stop/restart/status] ceph-osd@0.service

设置ceph-osd随Linux 系统自动启动:

$ systemctl enable [email protected]

 
四、查看OSD 与HOST 的归属关系

1.登陆到任意一台MON主机,执行命令 
sudo ceph osd tree 


五、查看OSD node上 所有OSD data目录和 挂载磁盘
1.ls /var/lib/ceph/osd/
2. sudo mount |grep osd

你可能感兴趣的:(Ceph)