标签:name file 1.2 alt rap 版本 ntp stand 10g
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install centos-release-ceph-luminous -y
yum update -y
yum installl ceph-deploy -y
yum install ntp ntpdate ntp-doc -y
yum install openssh-server -y
#生成秘钥对
ssh-keygen
#将管理节点公钥注入到其他server
ssh-copy-id SERVER-
yum install yum-plugin-priorities -y
#在管理节点使用ceph-deploy部署ceph cluster
#创建部署目录
mkdir ~/my-cluster
cd ~/my-cluster
#从头开始(非第一次部署ceph,清理环境)
ceph-deploy purge {ceph-node}[{ceph-node}]
ceph-deploy purgedata {ceph-node}[{ceph-node}]
ceph-deploy forgetkeys
rm ceph.*
##创建集群
#创建monitor节点
#例如:ceph-deploy new {initial-monitor-node(s)}
ceph-deploy new node1
#安装ceph包到各个节点
ceph-deploy install node1 node2 node3
#初始化monitor节点,获取keys
ceph-deploy mon create-initial
#上述命令执行成功后,你会在当前目录下得到以下keyring文件
ceph.client.admin.keyring
ceph.bootstrap-mgr.keyring
ceph.bootstrap-osd.keyring
ceph.bootstrap-mds.keyring
ceph.bootstrap-rgw.keyring
ceph.bootstrap-rbd.keyring
#将keyring文件分发到各个节点
ceph-deploy admin node1 node2 node3
#部署manager(l版本之上才需要)
ceph-deploy mgr create node1
#部署osd节点(这里使用虚拟机,挂载了/dev/vdb卷)
ceph-deploy osd create node1:/dev/vdb node2:/dev/vdb node3:/dev/vdb
#检查集群,在管理节点执行
ceph health
ceph -s
#添加metadate server
ceph-deploy mds create node1
#添加monitors
ceph-deploy mon add node2 node3
#添加新的monitor节点之后,ceph会同步monitor,选举代表quorum
#查看quorum状态
ceph quorum_status --format json-pretty
#添加managers
#manager使用active/standby模式,多节点部署,可以在master down时,无缝顶替
ceph-deploy mgr create node2 node3
#添加rgw实例
#为了使用ceph object gateway,需要部署rgw实
例ceph-deploy rgw create node1
#rgw默认监听端口是7480,可以通过编辑ceph.conf修改端口
[client]
rgw frontends = civetweb port=80
ceph osd map {poolname}{object-name}
#创建一个对象,测试文件
echo {Test-data}> testfiles.txt
ceph osd pool create mytest 8
#使用rados put 命令指定对象名,含有对象数据的测试文件,pool name
#rados put {object-name} {file-path} --pool=mytest
rados put test-object-1 testfile.txt --pool=mytest
#验证ceph集群已经存储了此object
rados -p mytest ls
#找到对象位置
#ceph osd map {pool-name} {object-name}
ceph osd map mytest test-oobject-1
#ceph会输出对象位置
osdmap e537 pool ‘mytest‘(1) object ‘test-object-1‘-> pg 1.d1743484(1.4)-> up [1,0] acting [1,0]
#删除测试对象object
rados rm test-object-1--pool-mytest
#删除mytest pool
ceph osd pool rm mytest
#安装lvm
yum install lvm2 -y
#创建虚拟磁盘
mkdir /ceph && dd if=/dev/zero of=/ceph/ceph-volumes.img bs=1M count=10240 oflag=direct
sgdisk -g --clear /ceph/ceph-volumes.img
vgcreate ceph-volumes $(losetup --show -f /ceph/ceph-volumes.img)
lvcreate -L 9G -n ceph1 ceph-volumes
mkfs.xfs -f /dev/ceph-volumes/ceph1
#挂载
mkdir -p /var/local/osd1
mount /dev/ceph-volumes/ceph1 /var/local/osd1
标签:name file 1.2 alt rap 版本 ntp stand 10g
原文地址:https://www.cnblogs.com/nineep/p/8989795.html