ceph集群创建:
创建虚拟机器必须是单数例如:3,6,9等
主机名对相应的/etc/hosts,ip地址,yum源可以上网查询
修改所有主机的主机名,ssh免密连接,ntp时间同步,创建物理磁盘
hostnamectl set-hostname ceph1
reboot
1.关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
2.关闭selinux
setenforce 0
步骤一:
挂在相关的ceph资源包,ceph-mon,ceph-Tools,ceph-osd,ceph-ardosgw,ceph-mds
vim /etc/yum.repos.d/ceph.repo
[root@ceph16 yum.repos.d]# less ceph.repo
[Ceph-SRPMS]
name=Ceph SRPMS packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/SRPMS/
enabled=1
gpgcheck=0
type=rpm-md
[Ceph-aarch64]
name=Ceph aarch64 packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/aarch64/
enabled=1
gpgcheck=0
type=rpm-md
[Ceph-noarch]
name=Ceph noarch packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/noarch/
enabled=1
gpgcheck=0
type=rpm-md
[Ceph-x86_64]
name=Ceph x86_64 packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/x86_64/
enabled=1
gpgcheck=0
type=rpm-md
ceph-deploy 安装的时候只需要在后面加上参数就可以避免自定义ceph.repo yum源 被覆盖掉
第二步:vim /etc/hosts //编辑/etc/hosts主机名
vim /etc/hosts
192.168.1.10 ceph1
步骤三:ssh免密登陆
ssh-keygen -f ~/.ssh/id_rsa -N ''
for i in ceph{1..3}
do
ssh-copy-id -i $i
done
步骤四:时间同步
编辑/etc/chrony.conf
[student@root ~]$ cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
server 10.0.3.1 iburst #自己主机的网关
[student@root ~]$ for i in ceph{1..3}
do
scp /etc/chrony.conf $i:/etc
ssh $i "systemctl restart chronyd;systemctl enable chronyd"
scp /etc/yum.repos.d/ceph.repo $i:/etc/yum.repos.d/
ssh $i "yum clean all ;yum repolist"
done
步骤五添加物理磁盘:
物理机上为每个虚拟机准备3块20G磁盘(可以使用命令,也可以使用图形直接添加)
案例2:部署ceph集群
安装部署工具ceph-deploy
创建ceph集群
准备日志磁盘分区
创建OSD存储空间
查看ceph状态,验证
2.2 步骤
实现此案例需要按照如下步骤进行。
步骤一:安装部署软件ceph-deploy
1)在node1安装部署工具,学习工具的语法格式。
[root@node1 ~]# yum -y install ceph-deploy
[root@node1 ~]# ceph-deploy --help
[root@node1 ~]# ceph-deploy mon --help
2)创建目录
[root@node1 ~]# mkdir ceph-cluster
[root@node1 ~]# cd ceph-cluster/
步骤二:部署Ceph集群
1)给所有节点安装ceph相关软件包。
[root@node1 ceph-cluster]# for i in ceph1 ceph2 ceph3
do
ssh $i "yum install epel-release -y"
ssh $i "yum -y install ceph-mon ceph-osd ceph-mds ceph-radosgw"
done
2)创建Ceph集群配置,在ceph-cluster目录下生成Ceph配置文件。
在ceph.conf配置文件中定义monitor主机是谁。
[root@node1 ceph-cluster]# ceph-deploy new ceph1 ceph2 ceph3
3)初始化所有节点的mon服务,也就是启动mon服务(主机名解析必须对)。
[root@node1 ceph-cluster]# ceph-deploy mon create-initial
常见错误及解决方法(非必要操作,有错误可以参考):
如果提示如下错误信
ceph安装部署
于 2022-01-12 20:41:39 首次发布