使用ansible部署ceph集群

微信公众号:运维公众号,作者:wanger

基础配置

三台环境为centos7.9,以下配置需要在每台机器上执行

配置hosts解析
cat >> /etc/hosts <<EOF
192.168.2.23 node1
192.168.2.24 node2
192.168.2.25 node3
EOF
关闭防火墙和selinux
systemctl stop firewalld && systemctl disable firewalld
setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
分别在三个节点设置主机名
hostnamectl set-hostname node1
hostnamectl set-hostname node2
hostnamectl set-hostname node3
配置主机时间同步
systemctl restart chronyd.service && systemctl enable chronyd.service
配置免密登录
ssh-keygen
ssh-copy-id -i .ssh/id_rsa.pub node1
ssh-copy-id -i .ssh/id_rsa.pub node2
ssh-copy-id -i .ssh/id_rsa.pub node3

安装pip和ansible、git
yum install python-pip ansible git -y

部署ceph集群

克隆存储库

这里我选择安装的是ceph nautilus版本

git clone https://github.com/ceph/ceph-ansible.git
cd ceph-ansible
git checkout stable-4.0
安装ansible依赖包
pip install --upgrade pip
pip install -r requirements.txt
修改hosts文件,添加安装的节点
cat >> /etc/ansible/hosts <<EOF
[mons]
node1
node2
node3

[osds]
node1
node2
node3

[mgrs]
node1

[mdss]
node1
node2
node3

[clients]
node1
node2
node3

[rgws]
node1
node2
node3

[grafana-server]
node1

EOF
备份group_vars下的yml文件
cd ceph-ansible/group_vars
for file in *;do cp $file ${file%.*};done
修改group_vars/all.yml配置
---
dummy:
mon_group_name: mons
osd_group_name: osds
rgw_group_name: rgws
mds_group_name: mdss
client_group_name: clients
mgr_group_name: mgrs
grafana_server_group_name: grafana-server
configure_firewall: False
ceph_origin: repository
ceph_origin: repository
ceph_repository: community
ceph_mirror: http://mirrors.aliyun.com/ceph
ceph_stable_key: http://mirrors.aliyun.com/ceph/keys/release.asc
ceph_stable_release: nautilus
ceph_stable_repo: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}"
public_network: "192.168.2.0/24"
cluster_network: "192.168.2.0/24"
monitor_interface: ens33
osd_auto_discovery: true
osd_objectstore: filestore
radosgw_interface: ens33
dashboard_admin_password: asd123456
grafana_admin_password: admin
pg_autoscale_mode: True
修改group_vars/osds.yml配置
devices:
  - /dev/sdb

修改site.yml配置
![image.png](https://img-blog.csdnimg.cn/img_convert/8f4e8480194ff98d7d44c456dd933920.png#align=left&display=inline&height=197&margin=[object Object]&name=image.png&originHeight=394&originWidth=597&size=18197&status=done&style=none&width=298.5)

开始进行安装

剩下的交给时间吧,十分钟左右就装好了

ansible-playbook -i /etc/ansible/hosts site.yml

查看安装状态,发现有一个警告,这是因为在之前的all.yml配置没有开启允许自动调整pool中的pg数pg_autoscale_mode: False,手动设置下即可

ceph osd pool set <pool-name> pg_autoscale_mode on

![image.png](https://img-blog.csdnimg.cn/img_convert/9aa45b0cae0bd111e1a93d3fe702ead3.png#align=left&display=inline&height=235&margin=[object Object]&name=image.png&originHeight=470&originWidth=529&size=32148&status=done&style=none&width=264.5)
![image.png](https://img-blog.csdnimg.cn/img_convert/de7ad047d63b8d6f19b8c0cc18d4466b.png#align=left&display=inline&height=438&margin=[object Object]&name=image.png&originHeight=875&originWidth=1893&size=113320&status=done&style=none&width=946.5)
![image.png](https://img-blog.csdnimg.cn/img_convert/f2d3419fd0b67f33c2905cb6a52bc1ba.png#align=left&display=inline&height=336&margin=[object Object]&name=image.png&originHeight=672&originWidth=1503&size=145990&status=done&style=none&width=751.5)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值