Ceph的安装和部署
Ceph版本:ceph version0.94.3
OS版本:ubuntu14.04
步骤1:建立互信
# ssh-keygen -t rsa
一路回车即可
# cd/root/.ssh/
# cpid_rsa.pub authorized_keys
# chmod 600id_rsa
# scpid_rsa authorized_keys ceph2:/root/.ssh/
# scpid_rsa authorized_keys ceph3:/root/.ssh/
步骤2:安装ceph
1) 搭建本地源。
2) apt-get --force-yes -y install ceph-common ceph-mds
步骤3:使用deploy进行部署
1) 安装ceph-deploy
# apt-getinstall ceph-deploy
# mkdir ceph-cluster&& cd ceph-cluster
# ceph-deploynew ceph1 ceph2 ceph3
# viceph.conf
[global]
fsid = 3d4c6584-42ca-43e0-ab83-6f2bdcbfcb9c
mon_initial_members = ceph1, ceph2, ceph3
mon_host = 192.168.7.239,192.168.7.240,192.168.7.238
auth_cluster_required = none
auth_service_required = none
auth_client_required = none
filestore_xattr_use_omap = true
public_network = 192.168.7.0/24
cluster_network = 192.168.7.0/24
mon clock drift allowed = 2
mon clock drift warn backoff = 30
mon的部署
# ceph-deploymon create-initial
//or ceph-deploy mon create ceph1 ceph2 ceph3
osd的部署
# mkdir /var/lib/ceph/osd/ceph-a&& mkdir /var/lib/ceph/osd/ceph-b
# mkfs.xfs-f /dev/vdb && mkfs.xfs -f /dev/vdc
# mount/dev/vdb /var/lib/ceph/osd/ceph-a
# mount/dev/vdc /var/lib/ceph/osd/ceph-b
# vi/etc/fstab
/dev/vdb /var/lib/ceph/osd/ceph-a xfs defaults 0 0
/dev/vdc /var/lib/ceph/osd/ceph-b xfs defaults 0 0
#ceph-deploy gatherkeys ceph1获得权限[t1]
# ceph-deployosd prepare \
ceph1:/var/lib/ceph/osd/ceph-a \
ceph1:/var/lib/ceph/osd/ceph-b \
ceph2:/var/lib/ceph/osd/ceph-c \
ceph2:/var/lib/ceph/osd/ceph-d \
ceph3:/var/lib/ceph/osd/ceph-e \
ceph3:/var/lib/ceph/osd/ceph-f
# ceph-deployosd activate \
ceph1:/var/lib/ceph/osd/ceph-a \
ceph1:/var/lib/ceph/osd/ceph-b \
ceph2:/var/lib/ceph/osd/ceph-c \
ceph2:/var/lib/ceph/osd/ceph-d \
ceph3:/var/lib/ceph/osd/ceph-e \
ceph3:/var/lib/ceph/osd/ceph-f
# ceph-deployadmin ceph1 ceph2 ceph3
添加删除osd:
删除osd:
#ceph osd out osd.3 #ceph –s up的数量减少1
#/etc/init.d/ceph stop osd.3 #查看到in的数量减少1
#ceph osd crush remove osd.3#将删除的osd从crush map中删除。
#ceph auth del osd.3 #清除osd的认证密钥
#ceph osd rm 3 #在osd map中清除osd
添加osd:
[t1]操作流程先去寻找:/etc/ceph/ceph.client.admin.keyring,然后再找/var/lib/ceph/bootstrap-osd/ceph.keyring和/var/lib/ceph/bootstrap-mds/ceph.keyring,最后发现ceph.bootstrap-mds.keyringkey from ceph1。
注意:disk zap 命令是不需要权限的,而osdprepare 需要bootstrap-mds.keyring