(一)Ceph-ansible部署ceph(mimic)

内容纲要

官方目前推荐使用 Ceph-ansible 来安装Ceph

Ceph组件概念解释

Ceph是一款分布式存储软件。提供了块存储(block),对象存储(object),文件存储(file system)。一般用于作为openstack k8s等云平台底层存储对接。运行Ceph的最低需要一个mon和一个osd组件,如果需要用Ceph文件系统还需要安装mds组件。

ceph官方文档:https://docs.ceph.com/en/latest/

1.环境介绍

   CentOS Linux release 7.8.2003 (Core)
   ceph版本(mimic)
   ceph-ansible   192.168.50.79
   ceph-node1     192.168.50.80   三块硬盘sdb sdc sdd
   ceph-node2     192.168.50.81   三块硬盘sdb sdc sdd
   ceph-node3     192.168.50.82   三块硬盘sdb sdc sdd

2.4台主机分别设置主机名

[root@init ~]# hostnamectl set-hostname ceph-ansible
[root@init ~]# hostnamectl set-hostname ceph-node1
[root@init ~]# hostnamectl set-hostname ceph-node2
[root@init ~]# hostnamectl set-hostname ceph-node3

3.4台主机分别设置相同hosts

[root@ceph-ansible ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.50.79	ceph-ansible	ceph79
192.168.50.80	ceph-node1	ceph80
192.168.50.81	ceph-node2	ceph81
192.168.50.82	ceph-node3	ceph82

4.4台主机关闭防火墙,关闭SElinux。

[root@ceph-ansible ~]# systemctl stop firewalld;systemctl disable firewalld
[root@ceph-ansible ~]# cat /etc/selinux/config 
SELINUX=disabled

5.4台主机设置ssh可信。

[root@ceph-ansible ~]# ssh-keygen -N ""
<br>Generating public/private rsa key pair.<br>Enter file in which to save the key (/root/.ssh/id_rsa):<br>Your identification has been saved in /root/.ssh/id_rsa.<br>Your public key has been saved in /root/.ssh/id_rsa.pub.<br>The key fingerprint is:<br>SHA256:LoFlW91VLSJnNUo79+vdo1kqvsZkKTJPIUiLWWq0ar8 root@ceph-ansible<br>The key's randomart image is:<br>+---[RSA 2048]----+<br>| ..+.o|<br>| . o ..o++…|<br>| . B = . .+=… |<br>| * * + . o . |<br>| o . o S . . .|<br>| o = o + .|<br>|. . . * = o |<br>| . . . + =.o|<br>| E. ooo+..+|<br>+----[SHA256]-----+

[root@ceph-ansible ~]# ssh-copy-id root@192.168.50.79
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.50.79 (192.168.50.79)' can't be established.
ECDSA key fingerprint is SHA256:7koaNBK+nI3GpmXgjO2Jv7Uuo4PlxMiVsIORvlYXIlc.
ECDSA key fingerprint is MD5:f6:57:a1:77:3d:ce:91:77:c8:3a:42:2b:86:56:79:24.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.50.79's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.50.79'"
and check to make sure that only the key(s) you wanted were added.

6.在ceph-ansible下载所需配置文件并配置

[root@ceph-ansible ~]# yum install git -y
[root@ceph-ansible ~]# git clone https://github.com/ceph/ceph-ansible
[root@ceph-ansible ~]# cd ceph-ansible/
[root@ceph-ansible ceph-ansible]# git checkout stable-3.2
[root@ceph-ansible ceph-ansible]# cp site.yml.sample site.yml
[root@ceph-ansible ceph-ansible]# yum install https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.6.9-1.el7.ans.noarch.rpm
[root@ceph-ansible ceph-ansible]# cp group_vars/all.yml.sample group_vars/all.yml
[root@ceph-ansible ceph-ansible]# cp group_vars/osds.yml.sample group_vars/osds.yml

[root@ceph-ansible ceph-ansible]# vi group_vars/all.yml
ceph_origin: repository
ceph_repository: community
ceph_stable_release: mimic
public_network: "192.168.50.0/24"
monitor_interface: eth0

[root@ceph-ansible ceph-ansible]# vi group_vars/osds.yml
devices:
  - /dev/sdb
  - /dev/sdc
  - /dev/sdd

[root@ceph-ansible ceph-ansible]# vi /etc/ansible/hosts
[mons]
ceph-node1
ceph-node2
ceph-node3

[osds]
ceph-node1
ceph-node2
ceph-node3

[mgrs]
ceph-node1
ceph-node2
ceph-node3

7.部署Ceph

[root@ceph-ansible ceph-ansible]# vi /root/ceph-ansible/hosts
[mons]
ceph-node1
ceph-node2
ceph-node3
[osds]
ceph-node1
ceph-node2
ceph-node3
[mgrs]
ceph-node1
ceph-node2
ceph-node3

[root@ceph-ansible ceph-ansible]# ansible-playbook -i hosts site.yml
Ceph-ansible deploy Ceph(mimic)

本文链接:https://www.wenjiangun.com/blog/906/

spacer

Leave a reply

评论审核已启用。您的评论可能需要一段时间后才能被显示。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据