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

环境要求

  1. 编译环境需要有swap分区,以免多线程编译时内存不够。

L版本ceph

编译ceph代码

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

vstart.sh启动一个调试环境

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

mstart.sh启动多个调试环境

配置环境变量

export PYTHONPATH=$PYTHONPATH:/home/clz/code/ceph/build/src/pybind/
export PATH=$PATH:/home/clz/code/ceph/build/bin/
export LD_LIBRARY_PATH=/home/clz/code/ceph/build/lib/

将脚本拷贝到build目录

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

创建多个集群

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

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

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

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

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

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

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

启rbd mirror进程

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

J版本ceph

编译启动vstart

已经有人总结在博客中,这样直接给出链接(感谢分享)。
https://blog.csdn.net/weixin_37871174/article/details/71157030

N版本ceph

编译ceph代码

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

gcc 7版本的配置

由于14.2.0使用了c++17需要依赖于gcc 7

yum -y install centos-release-scl
yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
scl enable devtoolset-7 bash  临时生效
source /opt/rh/devtoolset-7/enable
echo "source /opt/rh/devtoolset-7/enable" >>/etc/profile  长期生效
gcc -v 查看环境gcc版本
Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐