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

本文详细介绍Ceph集群的管理与维护操作,包括版本检查、集群状态查看、服务启停与重启、OSD与MON进程管理及数据目录查看等关键步骤。适用于CentOS和Ubuntu系统。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 ceph-mon@node1.service
● ceph-mon@node1.service - Ceph cluster monitor daemon
   Loaded: loaded (/usr/lib/systemd/system/ceph-mon@.service; 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/ceph-mon@node1.service
           └─3607 /usr/bin/ceph-mon -f --cluster ceph --id node1 --setuser ce...

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

$ systemctl enable ceph-mon@node1.service

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

$ systemctl list-units --type=service|grep ceph
  ceph-mgr@node1.service             loaded active running Ceph cluster manager daemon
  ceph-mon@node1.service             loaded active running Ceph cluster monitor daemon
  ceph-radosgw@rgw.node1.service     loaded active running Ceph rados gateway

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

$  systemctl list-unit-files|grep enabled|grep ceph
ceph-osd@.service                             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
● ceph-osd@node1.service - Ceph object storage daemon osd.node1
   Loaded: loaded (/usr/lib/systemd/system/ceph-osd@.service; 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 ceph-osd@0.service

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

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


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值