【云计算学习】ceph部署-190724V5.0

目录

清除环境... 1

设置节点同步... 1

设置免密登录... 1

部署节点... 2

初始化节点... 2

部署osd. 2

部署mgr. 2

创建客户端用户名和认证密钥(openstack客户端)... 2

创建cinder和glance用户... 2

 

 

 

清除环境

ceph-deploy purge {ceph-node} [{ceph-node}]

ceph-deploy purgedata {ceph-node} [{ceph-node}]

ceph-deploy forgetkeys

 

ps aux|grep ceph |awk '{print $2}'|xargs kill -9

ps -ef|grep ceph

umount /var/lib/ceph/osd/*

rm -rf /var/lib/ceph/osd/*

rm -rf /var/lib/ceph/mon/*

rm -rf /var/lib/ceph/mds/*

rm -rf /var/lib/ceph/bootstrap-mds/*

rm -rf /var/lib/ceph/bootstrap-osd/*

rm -rf /var/lib/ceph/bootstrap-rgw/*

rm -rf /var/lib/ceph/tmp/*

rm -rf /etc/ceph/*

rm -rf /var/run/ceph/*

 

设置节点同步

sudo yum install chrony

vim /etc/c

安装 SSH 服务器

yum install openssh-server

创建用户

ssh user@ceph-server

sudo useradd -d /home/{username} -m {username}

sudo passwd {username}

 

echo "{username} ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/{username}

sudo chmod 0440 /etc/sudoers.d/{username}

 

设置免密登录

在管理节点上生成 SSH 密钥并把其公钥分发到各 Ceph 节点

ssh-keygen

 

Generating public/private key pair.

Enter file in which to save the key (/ceph-admin/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /ceph-admin/.ssh/id_rsa.

Your public key has been saved in /ceph-admin/.ssh/id_rsa.pub.

 

ssh-copy-id c@osd1

 

部署节点

ceph-deploy new osd1 osd2

初始化节点

ceph-deploy mon initital

部署osd

for dev in /dev/sdb /dev/sdc /dev/sdd

do 

ceph-deploy disk zap osd1 $dev

ceph-deploy osd create osd1 --data $dev;

ceph-deploy disk zap osd2 $dev

ceph-deploy osd create osd2 --data $dev;

done

部署mgr

ceph-deploy mgr create osd1 osd2

ceph mgr module enable dashboard

开放端口7000

 

创建客户端用户名和认证密钥(openstack客户端)

创建cinder和glance用户

ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=rbd, allow rx pool=images'

[client.cinder]

         key = AQBV/TZdw2JPCxAAozRrGk5yh2q+LSU716ylrg==

ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'

[client.glance]

         key = AQDc/TZdkVFGOhAAoC9foucHV13pujrYXNdHdA==

 

计算节点

ceph auth get-or-create client.cinder | ssh controller sudo tee /etc/ceph/ceph.client.cinder.keyring

ssh controller sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring

 

控制节点

ceph auth get-or-create client.glance | ssh controller sudo tee /etc/ceph/ceph.client.glance.keyring

ssh controller sudo chown glance:glance /etc/ceph/ceph.client.glance.keyring

 

存储节点

ceph auth get-or-create client.cinder | ssh computer sudo tee /etc/ceph/ceph.client.cinder.keyring

ssh computer sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring

 

在控制节点、计算节点上添加ceph配置文件

scp /etc/ceph/ceph.conf controller:/etc/ceph/

scp /etc/ceph/ceph.conf computer:/etc/ceph/

 

在客户端上:

ceph -s --name client.cinder

 

单独创建一个客户端

ceph auth get-or-create client.rbd mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=rbd' |tee ./ceph.client.rbd.keyring

 

scp ceph.client.rbd.keyring /etc/ceph/ceph.conf 192.168.100.205:/etc/ceph/

若是遇到权限不够问题,chown –R c /etc/ceph

客户端

ceph -s --name client.rbd

 

中间略过控制节点、计算节点、存储节点配置…

 

通过cinder创建块设备(相当于镜像)

openstack image create "centos7.5" --file ~/centos.raw --disk-format raw --container-format bare --public

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值