準備一臺機器:linux
root@test3:~# cat /proc/version Linux version 3.13.0-32-generic (buildd@kissel) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014git
一·、下載ceph源碼web
準備下載ceph的源代碼 http://ceph.com/resources/downloads/,初學者儘可能在官網下載,若是在git上下載有時可能會缺乏文件,致使編譯不經過。shell
2、編譯源碼ubuntu
1. 下載源碼後,將源碼包(ceph-0.94.3.tar.gz)導入到 虛擬機中,而後解壓源碼包 測試
root@cci-test3:~/blog#:tar -xvf ceph-0.94.3.tar.gz ............................................. ceph-0.94.3/config.sub# ceph-0.94.3/py-compile ceph-0.94.3/README root@cci-test3:~/blog# ls ceph-0.94.3 ceph-0.94.3.tar.gz root@cci-test3:~/blog#
2. 安裝ceph須要依賴的的庫ui
root@cci-test3:~/blog#:apt-get install autotools-dev autoconf automake cdbs gcc g++ git libboost-dev libedit-dev libssl-dev libtool libfcgi libfcgi-dev libfuse-dev linux-kernel-headers libcrypto++-dev libcrypto++ libexpat1-dev pkg-config root@cci-test3:~/blog#:
3. 安裝庫完成後,進入ceph源碼根目錄spa
root@cci-test3:~/blog/ceph-0.94.3#:./autogen.sh ................... root@cci-test3:~/blog/ceph-0.94.3#:./configure ............... root@cci-test3:~/blog/ceph-0.94.3#: make -j5 .......... root@cci-test3:~/blog/ceph-0.94.3#:
編譯成功,這個編譯的時間會持續的比較久調試
4. 編譯代碼結束後,進入src目錄code
root@cci-test3:~/blog/ceph-0.94.3/src/#:MON=1 MDS=0 ./vstart.sh -d -n -x ...... root@cci-test3:~/blog/ceph-0.94.3/src/#:./ceph -s *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** cluster 05f0dc34-4a98-498a-9e89-06decaba704c health HEALTH_OK monmap e1: 1 mons at {a=192.168.138.95:6789/0} election epoch 2, quorum 0 a osdmap e9: 3 osds: 3 up, 3 in pgmap v2689: 8 pgs, 1 pools, 0 bytes data, 0 objects 54178 MB used, 48713 MB / 105 GB avail 8 active+clean root@cci-test3:~/blog/ceph-0.94.3/src/#
5. 調試集羣已經啓動成功,能夠使用命令中止集羣
root@cci-test3:~/blog/ceph-0.94.3/src/# ./stop.sh
6. 接下來就能夠更改代碼了,修改代碼後能夠從新編譯,而後啓動集羣。查看編譯後的集羣。
osd目錄:~/blog/ceph-0.94.3/src/dev/ log目錄:~/blog/ceph-0.94.3/src/out/
總結:按着上面的步驟修改代碼調試代碼就很方便了,你們能夠放開手腳去調試測試代碼了。接下來會深刻代碼去分析,敬請期待