通过vstart搭建ceph开发调试环境。

xiaoxiao2021-02-27  395

1、首先clone ceph源代码到你自己的机器上。

$ git clone https://github.com/ceph/ceph.git然后在选择一个稍微稳定的版本进行编译。比如我选择的就是 v10.2.5 $git checkout -b v10.2.5 v10.2.5$ git branch-master* v10.2.5

2、配置,编译ceph源码:步骤可以按照https://github.com/ceph/ceph/tree/v10.2.5社区提示的步骤进行操作。

2.1 $./install-deps.sh2.2 $./autogen.sh2.3 $./configure2.4 $make -j32 这里这是编译快点 -注意这里不需要make install,因为后面我们会用ceph提供的脚本vstart.sh启动相关的二进制文件,而不是把这些二进制文件安装到默认目录下。

3、编译完成后,cd src/目录下,执行vstart.sh脚本: $./vstart.sh -n -l -d 这里 “-d” 表示打开debug信息 “-n” 表示新建一个集群 “-l” 表示让集群运行在localhost上 此时启动过程中会打印一些告警。可以不关注。

4、启动成功后,可以通过ceph -s 命令查看集群状态 $ceph -s 2017-05-04 00:30:52.137959 7f65ffc1b700 -1 WARNING: the following dangerous and experimental features are enabled: * 2017-05-04 00:30:52.163612 7f65ffc1b700 -1 WARNING: the following dangerous and experimental features are enabled: * cluster cadae725-6ee5-4bdb-94e6-00ddff8a89a8 health HEALTH_OK monmap e1: 3 mons at {a=127.0.0.1:6789/0,b=127.0.0.1:6790/0,c=127.0.0.1:6791/0} election epoch 6, quorum 0,1,2 a,b,c fsmap e2: 0/0/1 up osdmap e10: 3 osds: 0 up, 0 in flags sortbitwise,require_jewel_osds pgmap v11: 24 pgs, 3 pools, 0 bytes data, 0 objects 0 kB used, 0 kB / 0 kB avail 24 creating 2017-05-04 00:30:52.352933 7f65ffc1b700 0 lockdep stop

$ceph osd tree 2017-05-04 00:31:19.524282 7f80adb1e700 -1 WARNING: the following dangerous and experimental features are enabled: * 2017-05-04 00:31:19.553579 7f80adb1e700 -1 WARNING: the following dangerous and experimental features are enabled: * ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY -1 3.00000 root default -2 3.00000 host node-dev-1 0 1.00000 osd.0 down 0 1.00000 1 1.00000 osd.1 down 0 1.00000 2 1.00000 osd.2 down 0 1.00000 2017-05-04 00:31:19.744010 7f80adb1e700 0 lockdep stop

5、此时整个集群就算启动完成了,为了调试研发使用,此时你完全可以修改ceph文件,然后再次make -j 32.然后再./vstart.sh.当然停止命令是./stop.sh

6、注意:如上面的ceph osd tree命令查看到osd的状态为down,这个原因是在启动vstart脚本的时候,会去检查当前osd所在的目录的文件系统支持的最大attr value size = 1024(此时我的宿主机的文件系统是ext4)小于osd 默认的osd_max_object_name_len(2048),所以此时启动osd的时候出错,启动OSD失败。 2017-05-04 18:40:47.329270 7f805398e800 -1 filestore WARNING: max attr value size (1024) is smaller than osd_max_object_name_len (2048). Your backend filesystem appears to not support attrs large enough to handle the configured max rados name size. You may get unexpected ENAMETOOLONG errors on rados operations or buggy behavior 2017-05-04 18:40:47.342835 7f805398e800 -1 journal FileJournal::_open: disabling aio for non-block journal. Use journal_force_aio to force use of aio anyway 为了解决该问题,需要将vstart.sh脚本的OSD的配置信息进行重新设置,并小于1024,而不采用默认值2048。修改如下: $vi vstart.sh ………….

[osd] $DAEMONOPTS osd data = $CEPH_DEV_DIR/osd\$id osd journal = $CEPH_DEV_DIR/osd\$id/journal osd journal size = 100 osd class tmp = out osd class dir = $OBJCLASS_PATH osd scrub load threshold = 2000.0 osd debug op order = true osd max object name len = 256 //新增这行 osd max object namespace len = 64。//新增这行

………….

7、此时在进行./vstart -d -n -l $ceph osd tree 2017-05-04 18:03:53.938235 7fa533657700 -1 WARNING: the following dangerous and experimental features are enabled: * 2017-05-04 18:03:53.966977 7fa533657700 -1 WARNING: the following dangerous and experimental features are enabled: * ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY -1 3.00000 root default -2 3.00000 host node-dev-1 0 1.00000 osd.0 up 1.00000 1.00000 1 1.00000 osd.1 up 1.00000 1.00000 1.00000 osd.2 up 1.00000 1.00000 ▽017-05-04 18:03:54.157370 7fa533657700 0 lockdep stop

转载请注明原文地址: https://www.6miu.com/read-986.html

最新回复(0)