本文作者:丁辉
Docker单机部署Ceph集群(无裸盘)
无压力 C+V 即可部署成功
创建Ceph专用网络
1
docker network create --driver bridge --subnet 172.20.0.0/16 ceph-network
拉取搭建用镜像
1
docker pull ceph/daemon:latest
搭建mon节点
1
2
3
4
5
6
7
8
9
10
11docker run -d --name ceph-mon \
--restart=always \
--network ceph-network --ip 172.20.0.10 \
-e MON_NAME=ceph-mon \
-e MON_IP=172.20.0.10 \
-e CEPH_PUBLIC_NETWORK=172.20.0.0/16 \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /var/log/ceph/:/var/log/ceph/ \
-v /etc/localtime:/etc/localtime:ro \
ceph/daemon:latest mon禁用不安全认证
这个参数控制是否允许在集群中通过全局 ID 回收机制(global ID reclaim)来认证用户身份
1
docker exec ceph-mon ceph config set mon auth_allow_insecure_global_id_reclaim false
创建 osd 秘钥
1
docker exec ceph-mon ceph auth get client.bootstrap-osd -o /var/lib/ceph/bootstrap-osd/ceph.keyring
搭建 osd 节点
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35docker run -d --name ceph-osd-1 \
--privileged=true \
--restart=always \
--network ceph-network --ip 172.20.0.11 \
-e OSD_TYPE=directory \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /var/log/ceph/:/var/log/ceph/ \
-v /var/lib/ceph/osd/osd-1:/var/lib/ceph/osd \
-v /etc/localtime:/etc/localtime:ro \
ceph/daemon:latest osd
docker run -d --name ceph-osd-2 \
--privileged=true \
--restart=always \
--network ceph-network --ip 172.20.0.12 \
-e OSD_TYPE=directory \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /var/log/ceph/:/var/log/ceph/ \
-v /var/lib/ceph/osd/osd-2:/var/lib/ceph/osd \
-v /etc/localtime:/etc/localtime:ro \
ceph/daemon:latest osd
docker run -d --name ceph-osd-3 \
--privileged=true \
--restart=always \
--network ceph-network --ip 172.20.0.13 \
-e OSD_TYPE=directory \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /var/log/ceph/:/var/log/ceph/ \
-v /var/lib/ceph/osd/osd-3:/var/lib/ceph/osd \
-v /etc/localtime:/etc/localtime:ro \
ceph/daemon:latest osd搭建 mgr 节点
1
2
3
4
5
6
7
8
9docker run -d --name ceph-mgr \
--restart=always \
--network ceph-network --ip 172.20.0.14 \
-p 7000:7000 \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /var/log/ceph/:/var/log/ceph/ \
-v /etc/localtime:/etc/localtime:ro \
ceph/daemon:latest mgr开启管理界面(查看此文档)
创建 rgw 秘钥
1
docker exec ceph-mon ceph auth get client.bootstrap-rgw -o /var/lib/ceph/bootstrap-rgw/ceph.keyring
搭建 rgw 节点
1
2
3
4
5
6
7
8
9
10docker run -d --name ceph-rgw \
--restart=always \
--network ceph-network --ip 172.20.0.15 \
-p 7480:7480 \
-e RGW_NAME=ceph-rgw \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /var/log/ceph/:/var/log/ceph/ \
-v /etc/localtime:/etc/localtime:ro \
ceph/daemon:latest rgw搭建 mds 节点
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15docker run -d --name ceph-mds \
--restart=always \
--network ceph-network --ip 172.20.0.16 \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /var/log/ceph/:/var/log/ceph/ \
-v /etc/localtime:/etc/localtime:ro \
-e MDS_NAME=ceph-mds \
-e CEPHFS_CREATE=1 \
-e CEPHFS_NAME=cephfs \
-e CEPHFS_DATA_POOL=cephfs_data \
-e CEPHFS_DATA_POOL_PG=128 \
-e CEPHFS_METADATA_POOL=cephfs_metadata \
-e CEPHFS_METADATA_POOL_PG=64 \
ceph/daemon:latest mds检查Ceph状态
1
docker exec ceph-mon ceph -s
挂载地址为:172.20.0.10:6789
卸载清理
清理容器
1
2
3
4
5
6
7docker rm -f ceph-mon
docker rm -f ceph-osd-1
docker rm -f ceph-osd-2
docker rm -f ceph-osd-3
docker rm -f ceph-mgr
docker rm -f ceph-rgw
docker rm -f ceph-mds清理持久化目录
1
rm -rf {/etc/ceph,/var/lib/ceph,/var/log/ceph}
清理 Docker 网络
1
docker network rm ceph-network
I'm so cute. Please give me money.
- 本文链接: https://blog.offends.cn/Kubernetes/存储/Ceph/Docker单机部署Ceph集群(无裸盘).html
- 版权声明: 本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。