文章目錄
- 環境要求
- L版本ceph
-
- 編譯ceph代碼
- vstart.sh啟動一個調試環境
- mstart.sh啟動多個調試環境
-
- 配置環境變量
- 将腳本拷貝到build目錄
- 建立多個叢集
- 啟rbd mirror程序
- J版本ceph
-
- 編譯啟動vstart
- N版本ceph
-
- 編譯ceph代碼
- gcc 7版本的配置
轉載請注明:https://blog.csdn.net/huigui65/article/details/81986092
修改ceph代碼之後可以隻編譯一部分後進行調試。這時可以使用vstart.sh起一個虛拟的測試環境。vstart.sh啟動一個測試環境在github有教程。如果要測試rbd mirror需要兩個叢集,這時可以使用ceph/src/mvstart.sh啟動多個叢集進行測試。再此記錄這兩種調試的方法。
環境要求
- 編譯環境需要有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 [email protected]
./bin/rbd -c ./run/remote/ceph.conf mirror pool peer add rbd [email protected]
./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版本