基础配置
三台环境为centos7.9,以下配置需要在每台机器上执行
配置hosts解析
1cat >> /etc/hosts <<EOF
2192.168.2.23 node1
3192.168.2.24 node2
4192.168.2.25 node3
5EOF
关闭防火墙和selinux
1systemctl stop firewalld && systemctl disable firewalld
2setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
分别在三个节点设置主机名
1hostnamectl set-hostname node1
2hostnamectl set-hostname node2
3hostnamectl set-hostname node3
配置主机时间同步
1systemctl restart chronyd.service && systemctl enable chronyd.service
配置免密登录
1ssh-keygen
2ssh-copy-id -i .ssh/id_rsa.pub node1
3ssh-copy-id -i .ssh/id_rsa.pub node2
4ssh-copy-id -i .ssh/id_rsa.pub node3
安装pip和ansible、git
1yum install python-pip ansible git -y
部署ceph集群
克隆存储库
这里我选择安装的是ceph nautilus版本
1git clone https://github.com/ceph/ceph-ansible.git
2cd ceph-ansible
3git checkout stable-4.0
安装ansible依赖包
1pip install --upgrade pip
2pip install -r requirements.txt
修改hosts文件,添加安装的节点
1cat >> /etc/ansible/hosts <<EOF
2[mons]
3node1
4node2
5node3
6
7[osds]
8node1
9node2
10node3
11
12[mgrs]
13node1
14
15[mdss]
16node1
17node2
18node3
19
20[clients]
21node1
22node2
23node3
24
25[rgws]
26node1
27node2
28node3
29
30[grafana-server]
31node1
32
33EOF
备份group_vars下的yml文件
1cd ceph-ansible/group_vars
2for file in *;do cp $file ${file%.*};done
修改group_vars/all.yml配置
1---
2dummy:
3mon_group_name: mons
4osd_group_name: osds
5rgw_group_name: rgws
6mds_group_name: mdss
7client_group_name: clients
8mgr_group_name: mgrs
9grafana_server_group_name: grafana-server
10configure_firewall: False
11ceph_origin: repository
12ceph_origin: repository
13ceph_repository: community
14ceph_mirror: http://mirrors.aliyun.com/ceph
15ceph_stable_key: http://mirrors.aliyun.com/ceph/keys/release.asc
16ceph_stable_release: nautilus
17ceph_stable_repo: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}"
18public_network: "192.168.2.0/24"
19cluster_network: "192.168.2.0/24"
20monitor_interface: ens33
21osd_auto_discovery: true
22osd_objectstore: filestore
23radosgw_interface: ens33
24dashboard_admin_password: asd123456
25grafana_admin_password: admin
26pg_autoscale_mode: True
修改group_vars/osds.yml配置
1devices:
2 - /dev/sdb
修改site.yml配置
开始进行安装
剩下的交给时间吧,十分钟左右就装好了
1ansible-playbook -i /etc/ansible/hosts site.yml
查看安装状态,发现有一个警告,这是因为在之前的all.yml配置没有开启允许自动调整pool中的pg数 pg_autoscale_mode: False
,手动设置下即可
1ceph osd pool set <pool-name> pg_autoscale_mode on