
Bài viết này sẽ hướng dẫn bạn cách Triển Khai Cụm Ceph Với Ansible Trên Ubuntu 20.04. Nếu bạn cần hỗ trợ, xin vui lòng liên hệ VinaHost qua Hotline 1900 6046 ext.3, email về support@vinahost.vn hoặc chat với VinaHost qua livechat https://livechat.vinahost.vn/chat.php.
Mục lục
ẩn
1. Bước 1: Cài đặt ceph-ansible trên ceph1
root@ceph1:~# git clone https://github.com/ceph/ceph-ansible.git root@ceph1:~# cd ceph-ansible/ root@ceph1:~/ceph-ansible# git checkout stable-6.0 Branch 'stable-6.0' set up to track remote branch 'stable-6.0' from 'origin'. Switched to a new branch 'stable-6.0' root@ceph1:~/ceph-ansible# git pull Already up to date. root@ceph1:~/ceph-ansible# apt -y install python3-pip root@ceph1:~/ceph-ansible# pip install -r requirements.txt
2. Bước 2: Cấu hình hostname
root@ceph1:~# vi /etc/hostnames 192.168.1.101 ceph1 192.168.1.102 ceph2 192.168.1.103 ceph3
3. Bước 3: Thiết lập kết nối SSH giữa các node
root@ceph1:~# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub The key fingerprint is: SHA256:7Hlk5jcGlfYWQ0GxwB03mAhxodSrtugs3MFhqHqRQ+w root@ceph1 The key's randomart image is: +---[RSA 3072]----+ | ++++oO=.| | . oo.*.o.| | . . . = + | | o . + + . o | | o o o S * o | | E + O . . | | . + . * + + | | . . o.o o o . | | . oo | +----[SHA256]-----+ root@ceph1:~# ssh-copy-id ceph1 root@ceph1:~# ssh-copy-id ceph2 root@ceph1:~# ssh-copy-id ceph3
4. Bước 4: Kiểm tra kết nối ssh giữa các node
root@ceph1:~# ssh ceph1 root@ceph1:~# ssh ceph2 root@ceph1:~# ssh ceph3
5. Bước 5: Cấu hình inventory
root@ceph1:~# mkdir -p /etc/asible root@ceph1:~# vim /etc/ansible/hosts [mons] ceph1 ceph2 ceph3 [osds] ceph1 ceph2 ceph3 [mgrs] ceph1 [grafana-server] ceph1
6. Bước 6: Tạo file các yml mới.
root@ceph1:~# cd ceph-ansible/ root@ceph1:~/ceph-ansible# cp site.yml.sample site.yml root@ceph1:~/ceph-ansible# cd group_vars root@ceph1:~/ceph-ansible/group_vars# cp all.yml.sample all.yml root@ceph1:~/ceph-ansible/group_vars# cp osds.yml.sample osds.yml
Cấu hình file all.yml
root@ceph1:~/ceph-ansible/group_vars# vi all.yml ceph_origin: repository ceph_repository: community ceph_stable_release: pacific monitor_interface: ens18 journal_size: 5120 cluster_network: 192.168.1.0/24 dashboard_enabled: True dashboard_admin_user: admin dashboard_admin_password: p@ssw0rd #Đổi password lại grafana_admin_user: admin grafana_admin_password: admin #Đổi password lại
Cấu hình file osds.yml
root@ceph1:~/ceph-ansible/group_vars# vi osds.yml devices: - /dev/sdb osd_auto_discovery: true
7. Bước 7: Chạy Ansible-playbook
root@ceph1:~/ceph-ansible# ansible-playbook site.yml
8. Bước 8: Truy cập thử web dashbroad
http://<192.168.1.101:8443>
Chúc bạn thực hiện thành công!
THAM KHẢO CÁC DỊCH VỤ TẠI VINAHOST
>> SERVER – COLOCATION – CDN
>> HOSTING
>> WEBSITE
>> TÊN MIỀN