Developer Guide (Quick) — Ceph Documentation
最新的ceph版本为Reef,想要体验一下,并且能够使用gdb来打断点查看。
记录一下编译流程。
起一个centos8容器
docker pull centos:8
IMAGE_ID='xxx'
NAME=ceph_build_centos_8
docker run --privileged -idt \
--name $NAME \
-v /data:/data \
--net host \
${IMAGE_ID} \
/usr/bin/bash
docker exec -it $NAME /bin/bash
安装依赖
cd /data/
git clone https://github.com/ceph/ceph.git --branch=reef --recursive
cd ceph/
./install-deps.sh
# 启用gcc-toolset-11,以使用高版本gcc:
dnf list gcc-toolset-*-toolchain
dnf install gcc-toolset-11-toolchain.x86_64
scl enable gcc-toolset-11 bash
# cmake, 可以关闭不需要的功能以提高速度:
./do_cmake.sh -DWITH_MANPAGE=OFF -DWITH_BABELTRACE=OFF -DWITH_MGR_DASHBOARD_FRONTEND=OFF -DWITH_RBD=OFF -DWITH_KRBD=OFF -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF
# build, 可通过--parallel来限制并发,避免编译内存爆掉:
cmake --build build --parallel 5
vstart:
RGW=1 MON=1 OSD=1 MDS=0 ../src/vstart.sh -d -n -x --without-dashboard
配置s3cmd:
[root@VM-146-97-centos build]# cat ~/.s3cfg
access_key=0555b35654ad1656d804
secret_key=h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q==
host_base=127.0.0.1:8000
host_bucket=127.0.0.1:8000/%(bucket)
use_https=False
signature_v2 = True
# 添加max-retries=0,禁止重试上传,从而可以避免打断点时被干扰:
s3cmd put 20MB s3://bucket0 --max-retries=0
配置awscli:
yum install awscli
aws configure
# 输入ak/sk
# 调用
aws s3api --endpoint http://127.0.0.1:8000 list-buckets
S3_HOST="http://127.0.0.1:8000"
PROFILE="default"
BUCKET="bucket0"
OBJECT="object0"
function put_object_multipart_low_level_init(){
aws s3api --endpoint-url $S3_HOST --profile $PROFILE \
create-multipart-upload --bucket $BUCKET --key $OBJECT
}
function put_object_multipart_low_level_put_obj(){
aws s3api --endpoint-url $S3_HOST --profile $PROFILE \
upload-part --bucket $BUCKET --key $OBJECT --part-number 1 --body $OBJECT --upload-id $UPLOAD_ID
}
function put_object_multipart_list_parts(){
aws s3api --endpoint-url $S3_HOST --profile $PROFILE \
list-parts --bucket $BUCKET --key $OBJECT --upload-id $UPLOAD_ID
}
function put_object_multipart_complete_multipart(){
aws s3api --endpoint-url $S3_HOST --profile $PROFILE \
complete-multipart-upload --multipart-upload file://multipart_upload.json --bucket $BUCKET \
--key $OBJECT --upload-id $UPLOAD_ID
}
其中, multipart_upload.json格式为:
{
"Parts": [
{
"ETag": "3b220181d40d8a726fccf08286cf043c",
"PartNumber": 1
}
]
}