Ceph集群维护笔记
作者:互联网
1. 更换故障盘
1. 1 查看故障盘osd id
ceph osd tree
1.2 销毁osd
ceph osd destroy 60 --yes-i-really-mean-it
#ceph osd purge 60 --yes-i-really-mean-it
#destroy可以保留osd id;purge不保留osd id
1.3 更换故障硬盘
1.4 查看新硬盘盘符
lsblk
1.5 擦除新硬盘
ceph-volume lvm zap /dev/sdg --destroy
1.6 预备&替换原osd
ceph-volume lvm prepare --osd-id 60 --bluestore --data /dev/sdg
#ceph-volume lvm prepare --bluestore --data /path/to/device
#ceph-volume lvm prepare --filestore --data volume_group/lv_name --journal /dev/sdh
#ceph-volume lvm prepare --filestore --data volume_group/lv_name --journal volume_group/journal_lv
1.7 查看osd fsid
cat /var/lib/ceph/osd/ceph-60/fsid
1.8 激活osd
ceph-volume lvm activate 60 78341e1b-3cdf-466f-bdec-fc5b09192e35
ceph-volume lvm list
# 也可以使用ceph-volume lvm create分配新ID创建osd(合并6/7/8步骤)
2. 扩容osd节点
scp master01:/etc/yum.repos.d/ceph_stable.repo /etc/yum.repos.d/ceph_stable.repo
scp master01:/etc/ceph/ceph.conf /etc/ceph
scp master01:/etc/ceph/ceph.client.admin.keyring /etc/ceph
scp master01:/var/lib/ceph/bootstrap-osd/ceph.keyring /var/lib/ceph/bootstrap-osd
yum install -y ceph-osd
ceph-volume lvm zap /dev/sdb --destroy
ceph-volume lvm zap /dev/sdc --destroy
ceph-volume lvm zap /dev/sdd --destroy
ceph-volume lvm zap /dev/sde --destroy
ceph-volume lvm create --data /dev/sdb --bluestore --block.db /dev/sdf --block.wal /dev/sdg --block.db-size 20G --block.wal-size 20G
ceph-volume lvm create --data /dev/sdc --bluestore --block.db /dev/sdf --block.wal /dev/sdg --block.db-size 20G --block.wal-size 20G
ceph-volume lvm create --data /dev/sdd --bluestore --block.db /dev/sdf --block.wal /dev/sdg --block.db-size 20G --block.wal-size 20G
ceph-volume lvm create --data /dev/sde --bluestore --block.db /dev/sdf --block.wal /dev/sdg --block.db-size 20G --block.wal-size 20G
3. 缩容osd节点
3.1 停止所有osd服务
systemctl stop ceph-osd@13.server
systemctl stop ceph-osd@14.server
systemctl stop ceph-osd@15.server
systemctl stop ceph-osd@16.server
3.2 销毁所有osd
ceph osd purge 13 --yes-i-really-mean-it
ceph osd purge 14 --yes-i-really-mean-it
ceph osd purge 15 --yes-i-really-mean-it
ceph osd purge 16 --yes-i-really-mean-it
3.3 擦除磁盘数据
ceph-volume lvm zap --osd-id 13 --destroy
ceph-volume lvm zap --osd-id 14 --destroy
ceph-volume lvm zap --osd-id 15 --destroy
ceph-volume lvm zap --osd-id 16 --destroy
3.4 清除crush数据
ceph osd crush tree
ceph osd crush rm node03
3.5 删除osd应用
yum remove -y ceph-osd ceph-common
4. 调整PG
Total PGs = ((Total_number_of_OSD * 100) / max_replication_count) / pool_count, 结算的结果往上取靠近2的N次方的值。
ceph osd lspools
ceph osd pool get pool1 all
ceph osd pool set pool1 pg_num 2048
ceph osd pool set pool1 pgp_num 2048
5. 报警提示:1 daemons have recently crashed
ceph crash ls-new
ceph crash info
ceph crash archive-all
标签:volume,ceph,--,笔记,Ceph,集群,dev,lvm,osd 来源: https://www.cnblogs.com/wang-hongwei/p/16326509.html