本文共 6080 字,大约阅读时间需要 20 分钟。
[root@localhost ~]# mkdir -p /data01/mon4[root@localhost ~]# mkdir -p /data01/mon5启动容器 :
# docker run -d --net=none --dns=202.101.172.35 --name=mon4 --hostname=mon4 --privileged=true -v /data01/mon4:/data01 digoal/sshd_ceph:giant# docker run -d --net=none --dns=202.101.172.35 --name=mon5 --hostname=mon5 --privileged=true -v /data01/mon5:/data01 digoal/sshd_ceph:giant配置容器网络 :
./pipework.sh docker0 -i eth0 mon4 172.17.0.9/16./pipework.sh br0 -i eth1 mon4 172.18.0.9/16./pipework.sh br1 -i eth2 mon4 172.19.0.9/16./pipework.sh docker0 -i eth0 mon5 172.17.0.10/16./pipework.sh br0 -i eth1 mon5 172.18.0.10/16./pipework.sh br1 -i eth2 mon5 172.19.0.10/16ssh 172.17.0.9ip route add default via 172.17.42.1 dev eth0ssh 172.17.0.10ip route add default via 172.17.42.1 dev eth0配置所有节点主机名(所有节点) :
ssh to 172.17.0.2, 3, 4, 9, 10vi /etc/hosts172.17.0.1 deploy172.17.0.2 mon1172.17.0.3 mon2172.17.0.4 mon3172.17.0.9 mon4172.17.0.10 mon5172.17.0.5 osd1172.17.0.6 osd2172.17.0.7 osd3172.17.0.8 osd4
[root@mon4 ~]# mkdir -p /var/lib/ceph/mon/ceph-4[root@mon5 ~]# mkdir -p /var/lib/ceph/mon/ceph-5或者你可以使用非默认目录, 使用非默认目录后, 不能使用/etc/init.d/ceph来启动mon :
[root@mon4 ~]# mkdir -p /data01/ceph/mon/ceph-4[root@mon5 ~]# mkdir -p /data01/ceph/mon/ceph-5
[root@localhost ~]# ssh 172.17.0.2root@172.17.0.2's password: Last login: Tue Dec 9 16:13:47 2014 from 172.17.42.1[root@mon1 ~]# ceph-mon --mkfs -i mon4 --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring ceph-mon: set fsid to f649b128-963c-4802-ae17-5a76f36c4c76ceph-mon: created monfs at /var/lib/ceph/mon/ceph-mon4 for mon.mon4[root@mon1 ~]# ceph-mon --mkfs -i mon5 --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring ceph-mon: set fsid to f649b128-963c-4802-ae17-5a76f36c4c76ceph-mon: created monfs at /var/lib/ceph/mon/ceph-mon5 for mon.mon5
[root@mon1 ~]# scp /etc/ceph/ceph.conf /etc/ceph/ceph.client.admin.keyring 172.17.0.9:/etc/ceph[root@mon1 ~]# scp /etc/ceph/ceph.conf /etc/ceph/ceph.client.admin.keyring 172.17.0.10:/etc/ceph2. 接收KEY
[root@mon4 ~]# ceph auth get mon. -o /tmp/keyexported keyring for mon.[root@mon5 ~]# ceph auth get mon. -o /tmp/keyexported keyring for mon.3. 接收cluster map信息
[root@mon4 ~]# ceph mon getmap -o /tmp/mapgot monmap epoch 1[root@mon5 ~]# ceph mon getmap -o /tmp/mapgot monmap epoch 14. 生成数据目录文件
[root@mon4 ~]# ceph-mon -i mon4 --mkfs --monmap /tmp/map --keyring /tmp/key --mon-data /data01/ceph/mon/ceph-4ceph-mon: set fsid to f649b128-963c-4802-ae17-5a76f36c4c76ceph-mon: created monfs at /data01/ceph/mon/ceph-4 for mon.mon4[root@mon5 ~]# ceph-mon -i mon5 --mkfs --monmap /tmp/map --keyring /tmp/key --mon-data /data01/ceph/mon/ceph-5ceph-mon: set fsid to f649b128-963c-4802-ae17-5a76f36c4c76ceph-mon: created monfs at /data01/ceph/mon/ceph-5 for mon.mon5# ceph-mon --helpusage: ceph-mon -i monid [flags] --debug_mon n debug monitor level (e.g. 10) --mkfs build fresh monitor fs --force-sync force a sync from another mon by wiping local data (BE CAREFUL) --yes-i-really-mean-it mandatory safeguard for --force-sync --compact compact the monitor store --osdmap5. 添加新增节点(在任意节点添加一次即可).only used when --mkfs is provided: load the osdmap from --inject-monmap write the monmap to the local monitor store and exit --extract-monmap extract the monmap from the local monitor store and exit --mon-data where the mon store and keyring are located --conf/-c FILE read configuration from the given configuration file --id/-i ID set ID portion of my name --name/-n TYPE.ID set name --cluster NAME set cluster name (default: ceph) --version show version and quit -d run in foreground, log to stderr. -f run in foreground, log to usual location. --debug_ms N set message debug level (e.g. 1)
[root@mon4 ~]# ceph mon add mon4 172.17.0.9port defaulted to 6789; added mon.mon4 at 172.17.0.9:6789/0[root@mon4 ~]# ceph mon add mon5 172.17.0.10port defaulted to 6789; added mon.mon5 at 172.17.0.10:6789/0启动mon
[root@mon4 ~]# ceph-mon -i mon4 --public-addr 172.17.0.9 --mon-data /data01/ceph/mon/ceph-4[root@mon4 ~]# ps -ewf|grep cephroot 223 1 3 17:45 pts/0 00:00:00 ceph-mon -i mon4 --public-addr 172.17.0.9 --mon-data /data01/ceph/mon/ceph-4root 254 27 0 17:45 pts/0 00:00:00 grep --color=auto ceph[root@mon5 ~]# ceph-mon -i mon5 --public-addr 172.17.0.10 --mon-data /data01/ceph/mon/ceph-5[root@mon5 ~]# ps -ewf|grep cephroot 127 1 2 17:45 pts/0 00:00:00 ceph-mon -i mon5 --public-addr 172.17.0.10 --mon-data /data01/ceph/mon/ceph-5root 160 28 0 17:45 pts/0 00:00:00 grep --color=auto ceph
[root@mon5 ~]# ceph -s cluster f649b128-963c-4802-ae17-5a76f36c4c76 health HEALTH_OK monmap e3: 5 mons at {mon1=172.17.0.2:6789/0,mon2=172.17.0.3:6789/0,mon3=172.17.0.4:6789/0,mon4=172.17.0.9:6789/0,mon5=172.17.0.10:6789/0}, election epoch 14, quorum 0,1,2,3,4 mon1,mon2,mon3,mon4,mon5 osdmap e29: 4 osds: 4 up, 4 in pgmap v265: 128 pgs, 1 pools, 0 bytes data, 0 objects 39588 MB used, 1597 GB / 1636 GB avail 128 active+clean
[root@xxxxxxxxxxxx ~]# cat /etc/ceph/ceph.conf .... 如下 : mon initial members = mon1, mon2, mon3, mon4, mon5mon host = 172.17.0.2, 172.17.0.3, 172.17.0.4, 172.17.0.9, 172.17.0.10[参考]
转载地址:http://rizua.baihongyu.com/