利用ceph-ansible工程弥姻,快速部署ceph集群
Centos 7
ansible 2.7
ceph luminous
ceph-ansible stable-3.2
注意:
根據(jù)ceph-ansible github說明,可通過stable-*分支穩(wěn)定部署ceph
stable-2.1 Support for ceph version jewel. This branch supports ansible versions 2.1 and 2.2.1.
stable-2.2 Support for ceph versions jewel and kraken. This branch supports ansible versions 2.1 and 2.2.2.
stable-3.0 Support for ceph versions jewel and luminous. This branch supports ansible versions 2.3.1, 2.3.2 and 2.4.2.
master Support for ceph versions jewel, and luminous. This branch supports ansible version 2.4.2
注意不同版本的ansible,需要使用不同的stable分支午阵,最新分支為stable3.2种吸,通過/ceph-ansible/roles/ceph-validate/tasks/check_system.yml中描述剪验,stable3.2支持ansible版本為2.4.x-2.6.x
- name: fail on unsupported ansible version
fail:
msg: "Ansible version must be between 2.4.x and 2.6.x!"
when:
- ansible_version.major|int == 2
- (ansible_version.minor|int < 4 or ansible_version.minor|int > 6)
這里需要使用ansible2.7操作ceph-ansible項(xiàng)目,使用分支為stable3.2其屏,需要將上面代碼注釋掉,否則版本驗(yàn)證這里不會(huì)通過
創(chuàng)建主機(jī)3臺(tái)缨该,依次命名為mon, osd1, osd2
mon 運(yùn)行mon偎行,mgr服務(wù)
osd1,osd2只啟動(dòng)osd服務(wù)
三臺(tái)主機(jī)配置mon到mon贰拿,osd1蛤袒,osd2的root用戶免密碼ssh登錄,注意mon到mon節(jié)點(diǎn)也要配置免密碼ssh登錄膨更,配置主機(jī)名與節(jié)點(diǎn)名稱相同妙真,配置/etc/hosts
10.0.0.6 mon
10.0.0.4 osd1
10.0.0.3 osd2
確認(rèn)網(wǎng)卡均為eth0,并檢查掛載硬盤設(shè)備荚守,例如/dev/vdb
安裝ansible(mon節(jié)點(diǎn)執(zhí)行)
yum -y install ansible
檢查ansible版本
[root@mon ceph-ansible]# ansible --version
ansible 2.7.8
config file = /root/ceph-ansible2/ceph-ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
加載ceph-ansible源碼(mon節(jié)點(diǎn)執(zhí)行)
#git clone https://github.com/ceph/ceph-ansible.git
#git checkout stable-3.2
修改配置(mon節(jié)點(diǎn)執(zhí)行)
修改/etc/ansible/hosts
[mons]
mon
[mgrs]
mon
[osds]
osd1
osd2
修改/ceph-ansible/group_vars/all.yml
#cp all.yml.sample all.yml
#vi all.yml
#cat all.yml
ceph_origin: repository
ceph_repository: community
ceph_stable_release: luminous
public_network: "10.0.0.0/24"
cluster_network: "10.0.0.0/24"
monitor_interface: eth0
devices:
- '/dev/vdb'
osd_scenario: collocated
public_network,cluster_network為當(dāng)前網(wǎng)段信息隐孽,monitor_interface配置網(wǎng)卡為各個(gè)主機(jī)網(wǎng)卡名稱
devices配置為硬盤設(shè)備,ceph_stable_release配置ceph版本健蕊,這里使用luminous
修改/ceph-ansible/site.yml
#cp site.yml.sample site.yml
主要配置該文件hosts
- hosts:
- mons
#- agents
- osds
#- mdss
#- rgws
#- nfss
#- restapis
#- rbdmirrors
#- clients
- mgrs
#- iscsigws
#- iscsi-gws # for backward compatibility only!
這里只留下mons,osds,mgrs
安裝ceph
#cd /ceph-ansible
#ansible-playbook site.yml
我這里安裝一路順利菱阵,如果有問題的話,可以用ansible-playbook site.yml -vvv再裝一次缩功,提示信息更詳細(xì)晴及,檢查下有什么問題
安裝完成后,檢查ceph集群狀態(tài)
#ceph -s
cluster:
id: 4ff55516-ade8-4801-b7bc-ad689bd75efd
health: HEALTH_OK
services:
mon: 1 daemons, quorum mon
mgr: mon(active)
osd: 2 osds: 2 up, 2 in
data:
pools: 0 pools, 0 pgs
objects: 0 objects, 0B
usage: 2.00GiB used, 37.8GiB / 39.8GiB avail
pgs:
添加dashboard
#ceph mgr module enable dashboard
#ceph mgr dump
{
"epoch": 10,
"active_gid": 4136,
"active_name": "mon",
"active_addr": "10.0.0.6:6800/18798",
"available": true,
"standbys": [],
"modules": [
"dashboard",
"status"
],
"available_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"status",
"zabbix"
],
"services": {
"dashboard": "http://mon:7000/"
}
}
這里可以看到嫡锌,dashboard直接啟動(dòng)了虑稼,并且7000端口的web service也成功啟動(dòng)了