- ceph安装
参考rabbitMQ
1、进入docker hub镜像仓库地址:https://hub.docker.com/
2、搜索ceph,进入官方的镜像,在tag页签中可以看到几种类型的镜像;
3、拉取镜像:
docker pull ceph/daemon:master-f0a1ab7-mimic-centos-7-x86_64 较新
# docker pull ceph/daemon:master-08456a7-mimic-centos-7-x86_64 较旧
docker images 查看所有镜像
创建共享网络:
docker network rm cephnet
docker network create --driver bridge --subnet=172.20.0.0/16 --gateway=172.20.0.1 cephnet
通过docker network inspect redisnet,可以看到网关信息
建立集群监控容器monitor
Ceph Monitor 维护着展示集群状态的各种图表
mkdir -p /home/chually/99_dockerData/cephCluster/cephEtc
mkdir -p /home/chually/99_dockerData/cephCluster/cephLib
mkdir -p /home/chually/99_dockerData/cephCluster/cephLog
chmod -R 777 /home/chually/99_dockerData/cephCluster/
docker run -d --name=cephMonitor --restart always --net=cephnet -v /home/chually/99_dockerData/cephCluster/cephEtc:/etc/ceph -v /home/chually/99_dockerData/cephCluster/cephLib:/var/lib/ceph -v /home/chually/99_dockerData/cephCluster/cephLog:/var/log/ceph -e MON_IP=172.20.0.2 -e CEPH_PUBLIC_NETWORK=172.20.0.0/16 -e CEPH_CLUSTER_NETWORK=172.20.0.0/16 76bdbb3960e3 mon
docker logs -f cephMonitor
查看monitor部署情况:docker exec -it cephMonitor ceph -s
docker exec -it cephMonitor /bin/bash
查看版本:ceph -v
查看详细信息:ceph -s
快速重建
docker stop cephMonitor
docker rm cephMonitor
rm -Rf /home/chually/99_dockerData/cephCluster/cephEtc/*
rm -Rf /home/chually/99_dockerData/cephCluster/cephLib/*
rm -Rf /home/chually/99_dockerData/cephCluster/cephLog/*
建立Mgr 对象存储守护进程
docker stop cephMgr
docker rm cephMgr
docker run -d --name=cephMgr --restart always --net=cephnet -v /home/chually/99_dockerData/cephCluster/cephEtc:/etc/ceph -v /home/chually/99_dockerData/cephCluster/cephLib:/var/lib/ceph -v /home/chually/99_dockerData/cephCluster/cephLog:/var/log/ceph 76bdbb3960e3 mgr
docker logs -f cephMgr
建立OSD对象存储守护进程
Ceph OSD为对象存储守护进程,提供实际的存储,默认情况下ceph集群需要部署3个OSD。添加磁盘分区参考《扩展磁盘空间,挂载点》
docker stop cephOsd1
docker rm cephOsd1
docker run -d --name cephOsd1 --restart always --net=cephnet --privileged=true --pid=host -v /home/chually/99_dockerData/cephCluster/cephEtc:/etc/ceph -v /home/chually/99_dockerData/cephCluster/cephLib:/var/lib/ceph -v /home/chually/99_dockerData/cephCluster/cephLog:/var/log/ceph -v /dev:/dev -v /cephOsd1:/var/lib/ceph/osd 76bdbb3960e3 osd_directory
docker logs -f cephOsd1
docker stop cephOsd2
docker rm cephOsd2
docker run -d --name cephOsd2 --restart always --net=cephnet --privileged=true --pid=host -v /home/chually/99_dockerData/cephCluster/cephEtc:/etc/ceph -v /home/chually/99_dockerData/cephCluster/cephLib:/var/lib/ceph -v /home/chually/99_dockerData/cephCluster/cephLog:/var/log/ceph -v /dev:/dev -v /cephOsd2:/var/lib/ceph/osd 76bdbb3960e3 osd_directory
docker logs -f cephOsd2
docker stop cephOsd3
docker rm cephOsd3
docker run -d --name cephOsd3 --restart always --net=cephnet --privileged=true --pid=host -v /home/chually/99_dockerData/cephCluster/cephEtc:/etc/ceph -v /home/chually/99_dockerData/cephCluster/cephLib:/var/lib/ceph -v /home/chually/99_dockerData/cephCluster/cephLog:/var/log/ceph -v /dev:/dev -v /cephOsd3:/var/lib/ceph/osd 76bdbb3960e3 osd_directory
docker logs -f cephOsd3
建立RGW并测试对象存储
Ceph RGW - Rados网关:提供S3与Swift相容的API,存储数据至对象存储。
docker run -d --name=cephRgw --restart always --net=cephnet -v /home/chually/99_dockerData/cephCluster/cephEtc:/etc/ceph -v /home/chually/99_dockerData/cephCluster/cephLib:/var/lib/ceph -v /home/chually/99_dockerData/cephCluster/cephLog:/var/log/ceph -p 8070:8080 76bdbb3960e3 rgw
(1)创建一个使用者
docker exec -it cephRgw /bin/bash
radosgw-admin user create --uid="chually" --display-name="default opt user" --email="chually#chually.com"
(2)创建环境参数配置文件
vim s3key.sh
key信息对照test用户
(3)列出当前bucket
./s3client list