ceph版本-jewel,osd用sas盘,ssd做journal

本例环境:

sdb sdc sdd 做osd磁盘

sde(ssd盘)做jornal盘,提前用分区工具划分好磁盘三个区,sde1 sde2 sde3

用ssd盘来journal ,命令执行如下

1.格式化磁盘

# ceph-deploy disk zap ceph1:sdb ceph1:sdc ceph1:sdd  #sdb sdc sdd为需要格式化的磁盘

2.准备osd

# ceph-deploy --overwrite-conf osd prepare ceph1:sdb:/dev/sde1 ceph1:sdc:/dev/sde2 ceph1:sdd:/dev/sde3

3.修改用来做jornal盘的权限

chown ceph:ceph /dev/sde1

chown ceph:ceph /dev/sde2

chown ceph:ceph /dev/sde3

4.激活osd

# ceph-deploy --overwrite-conf osd activate ceph1:sdb1:/dev/sde1 ceph1:sdc1:/dev/sde2 ceph1:sdd1:/dev/sde3

5.注意点:每次重启机器后需要重新窒息感修改用来做jornal盘的权限的命令(重启后每次需要手动启动)

# chown ceph:ceph /dev/sde1

# chown ceph:ceph /dev/sde2

# chown ceph:ceph /dev/sde3

或者是编辑/etc/rc.local文件加入

vi /etc/rc.local

/usr/bin/chown ceph:ceph /dev/sde1

/usr/bin/chown ceph:ceph /dev/sde2

/usr/bin/chown ceph:ceph /dev/sde3

要注意的是在centos7中,/etc/rc.local文件默认没有可执行权限

需要加入可执行权限

# ll /etc/rc.local

lrwxrwxrwx. 1 root root 13 Sep  4 16:01 /etc/rc.local -> rc.d/rc.local

# ll /etc/rc.d/rc.local

-rw-r--r--. 1 root root 507 Sep  7 21:51 /etc/rc.d/rc.local  # 没有可执行的权限

增加可执行权限

# chmod +x /etc/rc.d/rc.local

错误处理:

用ssd盘来journal,格式分区权限问题.报错,如下所示:

[ceph-node2][WARNIN] ceph_disk.main.FilesystemTypeError: Cannot discover filesystem type: device /dev/sdc: Line is truncated:

[ceph-node2][ERROR ] RuntimeError: command returned non-zero exit status: 1

[ceph_deploy][ERROR ] RuntimeError: Failed to execute command: /usr/sbin/ceph-disk -v activate --mark-init systemd --mount /dev/sdc

在报错的节点上执行下面命令

[root@ceph-node3 ~]# ceph-disk activate-all

或者是查看ceph osd的日志文件:

# cat /var/log/ceph/ceph-osd.0.log

2017-10-19 05:28:41.962892 7fefcd45f800 -1 filestore(/var/lib/ceph/osd/ceph-0) mount failed to open journal /var/lib/ceph/osd/ceph-0/journal: (13) Permission denied

2017-10-19 05:28:41.963240 7fefcd45f800 -1 osd.0 0 OSD:init: unable to mount object store

2017-10-19 05:28:41.963248 7fefcd45f800 -1  ** ERROR: osd init failed: (13) Permission denied

发现,权限有问题无法启动osd盘

解决办法:

增加用户和磁盘的权限,重启后也需要增加

#  chown ceph:ceph /dev/sdb2

推荐阅读更多精彩内容