创建群集
[2019-03-20 18:35:04,232][ceph_deploy.conf][DEBUG ] found configuration file at: /home/sceph/.cephdeploy.conf[2019-03-20 18:35:04,233][ceph_deploy.cli][INFO ] Invoked (2.0.1): /usr/bin/ceph-deploy new ceph1 sudo /usr/sbin/ip link showsudo /usr/sbin/ip addr show========================================
安装ceph文件[2019-03-21 10:36:07,664][ceph_deploy.conf][DEBUG ] found configuration file at: /home/sceph/.cephdeploy.conf
[2019-03-21 10:36:07,666][ceph_deploy.cli][INFO ] Invoked (2.0.1): /usr/bin/ceph-deploy install ceph1 ceph2 ceph3 sudo yum clean allsudo yum -y install epel-releasesudo yum -y install yum-plugin-prioritiessudo rpm --import https://download.ceph.com/keys/release.ascsudo yum remove -y ceph-releasesudo yum install -y https://download.ceph.com/rpm-mimic/el7/noarch/ceph-release-1-0.el7.noarch.rpmensuring that /etc/yum.repos.d/ceph.repo contains a high prioritysudo yum -y install ceph ceph-radosgw [2019-03-21 11:15:01,990][ceph1][INFO ] Running command: sudo ceph --version[2019-03-21 11:15:02,126][ceph1][DEBUG ] ceph version 13.2.5 (cbff874f9007f1869bfd3821b7e33b2a6ffd4988) mimic (stable) ====================================创建mon[2019-03-21 15:29:30,161][ceph_deploy.conf][DEBUG ] found configuration file at: /home/sceph/.cephdeploy.conf[2019-03-21 15:29:30,161][ceph_deploy.cli][INFO ] Invoked (2.0.1): /usr/bin/ceph-deploy mon create-initial sudo ceph-mon --cluster ceph --mkfs -i ceph1 --keyring /var/lib/ceph/tmp/ceph-ceph1.mon.keyring --setuser 167 --setgroup 167sudo systemctl enable ceph.target
sudo systemctl enable ceph-mon@ceph1sudo systemctl start ceph-mon@ceph1
sudo ceph --cluster=ceph --admin-daemon /var/run/ceph/ceph-mon.ceph1.asok mon_statussudo ceph --cluster=ceph --admin-daemon /var/run/ceph/ceph-mon.ceph1.asok mon_statussudo ceph --cluster=ceph --admin-daemon /var/run/ceph/ceph-mon.ceph1.asok mon_status
sudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --admin-daemon=/var/run/ceph/ceph-mon.ceph1.asok mon_status
sudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --name mon. --keyring=/var/lib/ceph/mon/ceph-ceph1/keyring auth get client.adminsudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --name mon. --keyring=/var/lib/ceph/mon/ceph-ceph1/keyring auth get client.bootstrap-mdssudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --name mon. --keyring=/var/lib/ceph/mon/ceph-ceph1/keyring auth get client.bootstrap-mgrsudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --name mon. --keyring=/var/lib/ceph/mon/ceph-ceph1/keyring auth get client.bootstrap-osdsudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --name mon. --keyring=/var/lib/ceph/mon/ceph-ceph1/keyring auth get client.bootstrap-rgw ================================推送配置[2019-03-21 17:22:03,950][ceph_deploy.conf][DEBUG ] found configuration file at: /home/sceph/.cephdeploy.conf[2019-03-21 17:22:03,950][ceph_deploy.cli][INFO ] Invoked (2.0.1): /usr/bin/ceph-deploy admin ceph1 ceph2 ceph3Pushing admin keys and conf to ceph3 ================================创建mgr[2019-03-21 17:26:53,722][ceph_deploy.conf][DEBUG ] found configuration file at: /home/sceph/.cephdeploy.conf[2019-03-21 17:26:53,723][ceph_deploy.cli][INFO ] Invoked (2.0.1): /usr/bin/ceph-deploy mgr create ceph2Deploying mgr, cluster ceph hosts ceph2:ceph2sudo ceph --cluster ceph --name client.bootstrap-mgr --keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring auth get-or-create mgr.ceph2 mon allow profile mgr osd allow * mds allow * -o /var/lib/ceph/mgr/ceph-ceph2/keyring
sudo systemctl enable ceph-mgr@ceph2================================
创建三个osd,在admin node上ceph-deploy osd create --data /dev/vdb ceph1ceph-deploy osd create --data /dev/vdb ceph2ceph-deploy osd create --data /dev/vdb ceph3====================================
到此完毕,检查状态是否正常sudo ceph healthsudo ceph -sceph quorum_status --format json-pretty====================================
实践,创建pool,并存储一个对象echo "11111" > my.txtceph osd pool create mypool 8rados put m1 my.txt --pool=mypoolrados -p mypool lsrados df检查到底存了没有
[root@ceph1 ~]# rados -p mypool lsm1[root@ceph1 ~]# rados dfPOOL_NAME USED OBJECTS CLONES COPIES MISSING_ON_PRIMARY UNFOUND DEGRADED RD_OPS RD WR_OPS WRmypool 12 B 1 0 3 0 0 0 0 0 B 1 1 KiBtotal_objects 1
total_used 3.0 GiBtotal_avail 177 GiBtotal_space 180 GiB[root@ceph1 ~]# cat my.txt11111111111标识对象位置
[root@ceph1 ~]# ceph osd map mypool m1osdmap e16 pool 'mypool' (1) object 'm1' -> pg 1.c3958388 (1.0) -> up ([1,2,0], p1) acting ([1,2,0], p1)[root@ceph1 ~]#删除对象
[root@ceph1 ~]# rados rm m1 --pool=mypool删除pool[root@ceph1 ~]# ceph osd pool rm mypoolError EPERM: WARNING: this will *PERMANENTLY DESTROY* all data stored in pool mypool. If you are *ABSOLUTELY CERTAIN* that is what you want, pass the pool name *twice*, followed by --yes-i-really-really-mean-it.[root@ceph1 ~]# ceph osd pool rm mypool mypool --yes-i-really-really-mean-itError EPERM: pool deletion is disabled; you must first set the mon_allow_pool_delete config option to true before you can destroy a pool ==================================ceph mgr module enable dashboardceph dashboard create-self-signed-cert禁用ssl
ceph config set mgr mgr/dashboard/ssl false[root@ceph2 yum.repos.d]# ceph mgr services
{ "dashboard": "https://192.168.7.152:9800/"}===================================
[sceph@ceph1 ~]$ ceph-deploy mds create ceph2=====================================[sceph@ceph1 ~]$ ceph-deploy --overwrite-conf rgw create ceph1
radosgw-admin user create --uid=786 --display-name=fff --system
radosgw-admin user info --uid=786ceph dashboard set-rgw-api-access-key Y2CAASJE4Z0HFAD26R1Rceph dashboard set-rgw-api-secret-key dJzSwCHeMkqhbksV0zcDnalPzBPjHz3wRG3aRlSN然后在dashboard上就可看到object gateway了
[root@ceph1 ceph]# systemctl status ceph-radosgw@ceph1=====================================
vi /etc/ceph/ceph.conf[client.rgw.ceph1]rgw_frontends = civetweb port=9080 systemctl restart ceph-radosgw.targetsystemctl -a #ceph-deploy --overwrite-conf config push ceph1=======================================
mon的数据库是rocksdbhttps://github.com/facebook/rocksdb/wiki/Administration-and-Data-Access-Tool在/var/lib/ceph/mon/ceph-ceph1/store.db59 unzip rocksdb-master.zip61 cd rocksdb-master65 yum install gcc gcc-c++ perl70 yum install perl72 make73 make install83 scp -r 192.168.7.151:/var/lib/ceph/mon/ceph-ceph1/store.db ~/87 cd ~/store.db/90 ~/rocksdb/rocksdb-master/ldb --db=007031.sst scan91 ~/rocksdb/rocksdb-master/sst_dump -h92 ~/rocksdb/rocksdb-master/sst_dump --file=007031.sst --command=scan93 ~/rocksdb/rocksdb-master/sst_dump --file=007031.sst --command=scan --read_num=597 ~/rocksdb/rocksdb-master/sst_dump --file=007031.sst --command=raw99 less 007031_dump.txt=======================================
[root@ceph1 rbdpool]# ceph pg map 8.13
osdmap e55 pg 8.13 (8.13) -> up [0,2,1] acting [0,2,1]