ceph 调试环境启动

转载请注明:https://blog.csdn.net/huigui65/article/details/81986092
修改ceph代码之后可以只编译一部分后进行调试。这时可以使用vstart.sh起一个虚拟的测试环境。vstart.sh启动一个测试环境在github有教程。如果要测试rbd mirror需要两个集群,这时可以使用ceph/src/mvstart.sh启动多个集群进行测试。再此记录这两种调试的方法。

1、编译ceph代码

cd ceph/
./install-deps.sh 安装依赖
./do_cmake.sh  cmake
cd build
make 编译
make help 查看有哪些target可以单独编译

2、vstart.sh启动一个调试环境

cd build
make vstart        # builds just enough to run vstart
../src/vstart.sh --debug --new -x --localhost --bluestore
./bin/ceph -s 

3、mstart.sh启动多个调试环境

(1)配置环境变量

具体的目录按照实际情况修改
export PYTHONPATH=$PYTHONPATH:{path_ceph}/ceph/build/src/pybind/:/data/ceph/src/pybind/
export PATH=$PATH:{path_ceph}/ceph/build/bin/
export LD_LIBRARY_PATH={path_ceph}/ceph/build/lib/

(2)将脚本拷贝到build目录

cp src/vstart.sh build/
cp src/stop.sh build/
cp src/mstart.sh build/
cp src/mstop.sh build/

(3)创建多个集群

./mstart.sh remote -n  -l --bluestore
./mstart.sh local -n  -l --bluestore

rados -c ./run/local/ceph.conf rmpool rbd rbd --yes-i-really-really-mean-it
rados -c ./run/remote/ceph.conf rmpool rbd rbd --yes-i-really-really-mean-it

rados -c ./run/local/ceph.conf mkpool rbd
rados -c ./run/remote/ceph.conf mkpool rbd

rbd -c ./run/local/ceph.conf mirror pool enable rbd image
rbd -c ./run/remote/ceph.conf mirror pool enable rbd image

rbd -c ./run/local/ceph.conf mirror pool peer add rbd client.admin@remote
rbd -c ./run/remote/ceph.conf mirror pool peer add rbd client.admin@local

rbd -c ./run/remote/ceph.conf mirror pool info rbd
rbd -c ./run/local/ceph.conf mirror pool info rbd

rbd -c ./run/local/ceph.conf create test --image-feature layering --image-feature exclusive-lock --image-feature journaling -s 100M
rbd -c ./run/local/ceph.conf mirror image enable test

4、启rbd mirror进程

拷贝两个集群的配置文件到build:
cp ./run/local/ceph.conf ./local.conf
cp ./run/remote/ceph.conf ./remote.conf
rbd-mirror -c remote.conf -d

猜你喜欢

转载自blog.csdn.net/huigui65/article/details/81986092