孔雀鱼zadull,蛇王站好趴下,三台租房
1 [root@deploy ~]# echo "172.24.8.75 cephclient" >>/etc/hosts
1 [root@cephclient ~]# yum -y update 2 [root@cephclient ~]# rm /etc/yum.repos.d/* -rf 3 [root@cephclient ~]# wget -o /etc/yum.repos.d/centos-base.repo http://mirrors.aliyun.com/repo/centos-7.repo 4 [root@cephclient ~]# yum -y install epel-release 5 [root@cephclient ~]# mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup 6 [root@cephclient ~]# mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup 7 [root@cephclient ~]# wget -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
1 [root@cephclient ~]# useradd -d /home/cephuser -m cephuser 2 [root@cephclient ~]# echo "cephuser" | passwd --stdin cephuser #cephclient节点创建cephuser用户 3 [root@cephclient ~]# echo "cephuser all = (root) nopasswd:all" > /etc/sudoers.d/cephuser 4 [root@cephclient ~]# chmod 0440 /etc/sudoers.d/cephuser 5 [root@deploy ~]# su - manager 6 [manager@deploy ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub cephuser@172.24.8.75
1 [root@deploy ~]# su - manager 2 [manager@deploy ~]$ cd my-cluster/ 3 [manager@deploy my-cluster]$ vi ~/.ssh/config 4 host node1 5 hostname node1 6 user cephuser 7 host node2 8 hostname node2 9 user cephuser 10 host node3 11 hostname node3 12 user cephuser 13 host cephclient 14 hostname cephclient #新增cephclient节点信息 15 user cephuser 16 [manager@deploy my-cluster]$ ceph-deploy install cephclient #安装ceph
1 ceph-deploy install cephclient --repo-url=https://mirrors.aliyun.com/ceph/rpm-mimic/el7/ --gpg-url=https://mirrors.aliyun.com/ceph/keys/release.asc
1 [manager@deploy my-cluster]$ ceph-deploy admin cephclient
1 [manager@deploy my-cluster]$ ssh node1 sudo ceph osd pool create mytestpool 64
1 [root@cephclient ~]# ceph osd lspools 2 [root@cephclient ~]# rbd pool init mytestpool
1 [root@cephclient ~]# rbd create mytestpool/mytestimages --size 4096 --image-feature layering
1 [root@cephclient ~]# rbd ls mytestpool 2 mytestimages 3 [root@cephclient ~]# rbd showmapped 4 id pool image snap device 5 0 mytestpool mytestimages - /dev/rbd0 6 [root@cephclient ~]# rbd info mytestpool/mytestimages
1 [root@cephclient ~]# rbd map mytestpool/mytestimages --name client.admin 2 /dev/rbd0
1 [root@cephclient ~]# mkfs.ext4 /dev/rbd/mytestpool/mytestimages 2 [root@cephclient ~]# lsblk
1 [root@cephclient ~]# sudo mkdir /mnt/ceph-block-device 2 [root@cephclient ~]# sudo mount /dev/rbd/mytestpool/mytestimages /mnt/ceph-block-device/ 3 [root@cephclient ~]# cd /mnt/ceph-block-device/ 4 [root@cephclient ceph-block-device]# echo 'this is my test file!' >> test.txt 5 [root@cephclient ceph-block-device]# ls 6 lost+found test.txt
1 [root@cephclient ~]# vim /etc/ceph/rbdmap 2 # rbddevice parameters 3 #poolname/imagename id=client,keyring=/etc/ceph/ceph.client.keyring 4 mytestpool/mytestimages id=admin,keyring=/etc/ceph/ceph.client.admin.keyring
1 [root@cephclient ~]# vi /etc/fstab 2 #…… 3 /dev/rbd/mytestpool/mytestimages /mnt/ceph-block-device ext4 defaults,noatime,_netdev 0 0
1 [root@cephclient ~]# systemctl enable rbdmap.service 2 [root@cephclient ~]# df -ht #查看验证
1 [root@cephclient ~]# vi /usr/lib/systemd/system/rbdmap.service 2 [unit] 3 description=map rbd devices 4 wantedby=multi-user.target #需要新增此行 5 #……
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
linux下文本编辑器vim的使用方法(复制、粘贴、替换、行号、撤销、多文件操作)
网友评论