欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ceph安装和常用命令

程序员文章站 2022-07-10 22:22:21
...
/etc/hosts
ssh-keygen
ssh-copy-id root@ceph-node1
systemctl stop firewalld.service
systemctl disable firewalld.service

setenforce 0
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config

mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
curl http://mirrors.163.com/.help/CentOS7-Base-163.repo -o /etc/yum.repos.d/CentOS-Base.repo
yum install epel-release -y && yum clean all && yum update -y

ntpdate pool.ntp.org
ln Shanghai

rpm -Uvh http://mirrors.163.com/ceph/rpm-jewel/el7/noarch/ceph-release-1-1.el7.noarch.rpm
yum update -y
yum install ceph-deploy -y


################
ceph-deploy new ceph-node1 ceph-node2 ceph-node3
ceph-deploy install ceph-node1 ceph-node2 ceph-node3
每个节点都起了ceph-mon
ceph-deploy mon create-initial
有osd错误忽略,
ceph-deploy disk zap ceph-node1:vdb ceph-node2:vdb ceph-node3:vdb

ceph-deploy osd create ceph-node1:vdb ceph-node2:vdb ceph-node3:vdb

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

ceph auth get-or-create client.k8s |ssh root@ceph-node1 tee /etc/ceph/ceph.client.k8s.keyring
ceph auth get-or-create client.k8s |ssh root@ceph-node2 tee /etc/ceph/ceph.client.k8s.keyring
ceph auth get-or-create client.k8s |ssh root@ceph-node3 tee /etc/ceph/ceph.client.k8s.keyring

ceph -s --name client.k8s

ceph osd lspools --name client.k8s

rbd ls -p k8s --name client.k8s
rbd create rbd1 -p k8s --size 10240 --name client.k8s
这个步骤需要内核支持,如果内核不支持,map的时候会报错
rbd create rbd2 -p k8s --size 10240 --name client.k8s  --image-feature layering

rbd ls -p k8s --name client.k8s
rbd info --image rbd1 -p k8s --name client.k8s

rbd map --image rbd1 -p k8s --name client.k8s

如果报错
dmesg |tail |grep rbd



ceph osd lspools
ceph mon dump
ceph df

ceph mon stat
ceph osd stat
ceph pg stat
ceph pg dump

ceph auth list
ceph osd tree

如果新加一个节点ceph-node4
在node1上
ssh-copy-id ceph-node4
ceph-deploy install ceph-node4
后面不会了



相关标签: ceph