使用docker安装ceph
#划分子网
docker network create --driver bridge --subnet 172.20.0.0/16 ceph-network
docker network ls
docker network inspect ceph-network
#用于存放ceph配置
mkdir -p /myceph/etc/ceph
#创建目录代表osd
mkdir -p /myceph/osd/0 /myceph/osd/1 /myceph/osd/2
# monitor node
docker run -itd --name monnode --network ceph-network --ip 172.20.0.10 -e MON_NAME=monnode -e MON_IP=172.20.0.10 -v /myceph/etc/ceph:/etc/ceph ceph/mon
#
docker exec monnode ceph osd create
docker exec monnode ceph osd create
docker exec monnode ceph osd create
#osd
docker run -itd --name osdnode0 --network ceph-network -e CLUSTER=ceph -e WEIGHT=1.0 -e MON_NAME=monnode -e MON_IP=172.20.0.10 -v /myceph/etc/ceph:/etc/ceph -v /myceph/osd/0:/var/lib/ceph/osd/ceph-0 ceph/osd
docker run -itd --name osdnode1 --network ceph-network -e CLUSTER=ceph -e WEIGHT=1.0 -e MON_NAME=monnode -e MON_IP=172.20.0.10 -v /myceph/etc/ceph:/etc/ceph -v /myceph/osd/1:/var/lib/ceph/osd/ceph-1 ceph/osd
docker run -itd --name osdnode2 --network ceph-network -e CLUSTER=ceph -e WEIGHT=1.0 -e MON_NAME=monnode -e MON_IP=172.20.0.10 -v /myceph/etc/ceph:/etc/ceph -v /myceph/osd/2:/var/lib/ceph/osd/ceph-2 ceph/osd
#object storage gateway
docker run -itd --name gwnode --network ceph-network --ip 172.20.0.9 -p 9080:80 -e RGW_NAME=gwnode -v /myceph/etc/ceph:/etc/ceph ceph/radosgw
docker exec monnode ceph -s