首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用ansible部署ceph集群

使用ansible部署ceph集群

作者头像
没有故事的陈师傅
发布2021-02-01 11:06:18
1.5K0
发布2021-02-01 11:06:18
举报
文章被收录于专栏:运维开发故事运维开发故事
巧者劳而知者忧,无能者无所求。饱食而遨游,泛若不系之舟,虚而遨游者也 《庄子·列御寇》

基础配置

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

配置hosts解析
cat >> /etc/hosts <<EOF
192.168.2.23 node1
192.168.2.24 node2
192.168.2.25 node3
EOF
关闭防火墙和selinuxsystemctl 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配置

开始进行安装

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

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

公众号:运维开发故事

github:https://github.com/orgs/sunsharing-note/dashboard

爱生活,爱运维

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2021-01-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 运维开发故事 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 配置hosts解析
  • 关闭防火墙和selinuxsystemctl stop firewalld && systemctl disable firewalld setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
  • 分别在三个节点设置主机名
  • 配置主机时间同步
  • 配置免密登录
  • 安装pip和ansible、git
  • 部署ceph集群
    • 克隆存储库
      • 安装ansible依赖包
        • 修改hosts文件,添加安装的节点
          • 备份group_vars下的yml文件
            • 修改group_vars/all.yml配置
              • 修改group_vars/osds.yml配置
                • 开始进行安装
                相关产品与服务
                Grafana 服务
                Grafana 服务(TencentCloud Managed Service for Grafana,TCMG)是腾讯云基于社区广受欢迎的开源可视化项目 Grafana ,并与 Grafana Lab 合作开发的托管服务。TCMG 为您提供安全、免运维 Grafana 的能力,内建腾讯云多种数据源插件,如 Prometheus 监控服务、容器服务、日志服务 、Graphite 和 InfluxDB 等,最终实现数据的统一可视化。
                领券
                问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档