1. Environment and description
Deploy ceph-0.87 on ubuntu14.04 server, set Rbdmap to mount/unload RBD block devices automatically, and export the RBD block of iSCSI with a TGT with RBD support.
2. Installing Ceph
1) Configure hostname with no password login
[Email protected]:/etc/ceph# cat/etc/hosts127.0.0.1localhost192.168.108.4 osd2.osd2osd2192.168.108.3 osd1.osd1osd1192.168.108.2 Mon0.mon0mon0
#示例如下ssh-keygenssh-copy-id-i/root/.ssh/id_rsa.pub OSD1
2) Install Ceph-deploy
Wget-q-o-' HTTPS://CEPH.COM/GIT/?P=CEPH.GIT;A=BLOB_PLAIN;F=KEYS/RELEASE.ASC ' | sudo apt-key add-echo deb http://ceph.com/debian-dumpling/$ (LSB_RELEASE-SC) main | sudo tee/etc/apt/sources.list.d/ceph.listapt-get updateapt-get install Ceph-deploy
3) Installing Ceph
Ceph-deploy new mon0 osd1 osd2ceph-deploy install mon0 osd1 osd2ceph-deploy Mon create mon0 osd1 osd2ceph-deploy Gatherkey S mon0 OSD1 Osd2ceph-deploy OSD prepare mon0:/cephmp1:/dev/sdf1 mon0:/cephmp2:/dev/sdf2 osd1:/cephmp1:/dev/sdf1 osd1:/ CEPHMP2:/DEV/SDF2 osd2:/cephmp1:/dev/sde1 osd2:/cephmp2:/dev/sde2ceph-deploy OSD Activate MON0:/CEPHMP1:/DEV/SDF1 MON0:/CEPHMP2:/DEV/SDF2 osd1:/cephmp1:/dev/sdf1 osd1:/cephmp2:/dev/sdf2 osd2:/cephmp1:/dev/sde1 Osd2:/cephmp2:/dev /sde2ceph-deploy MDS Create Mon0 OSD1 OSD2
Once installed, you can modify the/etc/ceph/ceph.conf file as needed, and then use the Ceph-deploy--overwrite-conf config push osd1 osd2 command to push the modified configuration file to another host. Then restart with the following command:
Restart Ceph-all
3. Configure Rbdmap
After you create a RBD block device and RBD map, if you do not RBD unmap in time, the system will hung on Umount this RBD device when you shut down the machine. So configuring Rbdmap is a must. First download and set up boot Rbdmap
$ sudo wget https://raw.github.com/ceph/ceph/a4ddf704868832e119d7949e96fe35ab1920f06a/src/init-rbdmap-O/etc/ init.d/rbdmap$ sudo chmod +x/etc/init.d/rbdmap$ sudo update-rc.d rbdmap defaults
Then create a RBD block device and use RBD map to mount the device, and then MKFS to format it with the following results:
[Email protected]:/etc/ceph# rbd ls iscsiiscsi-rbd[email protected]:/etc/ceph# RBD showmappedid pool image Snap Device 1 iSCSI ISCSI-RBD- /dev/rbd1 mkfs.xfs/dev/rbd1
Modify the/etc/init.d/rbdmap, change the/etc/rbdmap to the actual path of your rbdmap, and then write the Mount information to/etc/ceph/rbdmap (my Rbdmap path):
[Email protected]:/etc/ceph# cat/etc/ceph/rbdmap# rbddeviceparameters#poolname/imagenameid=client,keyring=/etc/ Ceph/ceph.client.keyringiscsi/iscsi-rbd
Because I disabled the CEPHX, I don't have to configure Keyring.
This allows manual control, and the switch can automatically mount and unload the RBD block device.
4. Configuring iSCSI that supports RBD export
Deploy Ceph on Ubuntu server14.04 with Ceph-deploy and other configurations