1、配置/etc/hosts文件
vim /etc/hosts
2、配置yum源,保證部署過程中能夠安裝ceph,可以先驗證一下yum源是否能夠使用
yum -y install ceph
3、安裝ceph-ansible ansible及添加祕鑰互信
ssh-keygen -t rsa
ssh-copy-id root@主機名
安裝ansible
yum install ansible -y
安裝ceph-ansible
git clone https://github.com/ceph/ceph-ansible.git
4、更改配置文件
命令:
cd ceph-ansible/
在當前目錄下新建hosts文件,並添加如下內容
vim hosts
[mons]
192.168.1.23
[osds]
192.168.1.23
[mgrs]
192.168.1.23
執行如下命令
mv site.yml.sample site.yml
vim group_vars/all.yml
---
ceph_origin: distro #(使用distro,則不會使用公網源)
ceph_repository: local
ceph_stable_release: luminous #(想安裝L版,寫成 luminous 即可,確保你的repo中有此版本的包)
public_network: "192.168.1.0/24"
cluster_network: "192.168.1.0/24"
mon_host: 192.168.1.23
monitor_interface: eth0
devices:
- '/dev/vdb' #(這裏是你虛機掛盤的位置,這個可以通過lsblk命令可以看到)
osd_scenario: collocated
執行如下命令,安裝ceph
ansible-playbook site.yml -i hosts
5、刪除ceph
執行如下命令
cp /root/ceph-ansible/infrastructure-playbooks/purge-cluster.yml /root/ceph-ansible/
ansible-playbook purge-cluster.yml -i hosts
就ok了。
注意:關於部署多節點的ceph的問題:
1.其他節點需要向主控節點添加祕鑰
2.每臺主機都需要更新yum源,不然找不到L版本的源。
3.關閉防火牆
4.最新版本ceph安裝需要裝python-notario library
yum -y install epel-release
yum -y install python-pip
pip install notario