Lingkungan
- Ubuntu 20.04 LTS Focal Fossa
- Ceph 17.2.X Quincy
Panduan
Prasyarat (Semua Ceph Node)
- Konfigurasi berkas hosts
cat<<EOF | sudo tee -a /etc/hosts
10.150.17.11 ceph01
10.150.17.12 ceph02
10.150.17.13 ceph03
EOF
- Memasang repository Ubuntu Cloud Archive (UCA) Focal-Yoga
sudo add-apt-repository cloud-archive:yoga
- Update, upgrade, dan pasang ceph
sudo apt update; sudo apt upgrade -y
sudo apt install -y ceph
Menyiapkan Ceph Monitor (ceph-mon)
Eksekusi tahap 1 - 8 hanya pada ceph01
- Membuat berkas konfigurasi ceph
sudo apt install -y uuid
FSID=$(uuid)
cat<<EOF | sudo tee -a /etc/ceph/ceph.conf
[global]
fsid = ${FSID}
mon initial members = ceph01, ceph02, ceph03
mon host = 10.150.17.11, 10.150.17.12, 10.150.17.13
public network = 10.150.17.0/24
auth cluster required = cephx
auth service required = cephx
auth client required = cephx
EOF
# Distribusikan ceph.conf
scp /etc/ceph/ceph.conf ceph02:/tmp/ceph.conf
ssh ceph02 sudo -S mv /tmp/ceph.conf /etc/ceph/ceph.conf
scp /etc/ceph/ceph.conf ceph03:/tmp/ceph.conf
ssh ceph03 sudo -S mv /tmp/ceph.conf /etc/ceph/ceph.conf
- Buat keyring ceph-mon
sudo ceph-authtool \
--create-keyring /tmp/ceph.mon.keyring \
--gen-key -n mon. --cap mon 'allow *'
- Buat keyring admin
sudo ceph-authtool \
--create-keyring /etc/ceph/ceph.client.admin.keyring \
--gen-key -n client.admin \
--cap mon 'allow *' \
--cap osd 'allow *' \
--cap mds 'allow *' \
--cap mgr 'allow *'
- Membuat keyring bootstrap-osd
sudo ceph-authtool \
--create-keyring /var/lib/ceph/bootstrap-osd/ceph.keyring \
--gen-key -n client.bootstrap-osd \
--cap mon 'profile bootstrap-osd' \
--cap mgr 'allow r'
- Menambahkan keyring yang sudah dibuat sebelumnya ke berkas ceph.mon.keyring
sudo ceph-authtool /tmp/ceph.mon.keyring \
--import-keyring /etc/ceph/ceph.client.admin.keyring
sudo ceph-authtool /tmp/ceph.mon.keyring \
--import-keyring /var/lib/ceph/bootstrap-osd/ceph.keyring
- Mengubah kepimilikan berkas ceph.mon.keyring
sudo chown ceph:ceph /tmp/ceph.mon.keyring
- Buat monitor map
monmaptool --create \
--add ceph01 10.150.17.11 \
--fsid ${FSID} /tmp/monmap
monmaptool \
--add ceph02 10.150.17.12 \
--fsid ${FSID} /tmp/monmap
monmaptool \
--add ceph03 10.150.17.13 \
--fsid ${FSID} /tmp/monmap
- Distribusikan client.admin, ceph-mon keyring, and monmap ke ceph02 & ceph03
# Salin admin keyring
sudo cp /etc/ceph/ceph.client.admin.keyring /tmp/ceph.client.admin.keyring
sudo chown $USER:$USER /tmp/{ceph.client.admin.keyring,ceph.mon.keyring,monmap}
# Sebarkan berkas keyring dan monmap ke node lain
scp /tmp/{ceph.client.admin.keyring,ceph.mon.keyring,monmap} ceph02:/tmp
scp /tmp/{ceph.client.admin.keyring,ceph.mon.keyring,monmap} ceph03:/tmp
# Pindahkan admin keyring ke direktori /etc/ceph
ssh ceph02 sudo -S mv /tmp/ceph.client.admin.keyring /etc/ceph/
ssh ceph03 sudo -S mv /tmp/ceph.client.admin.keyring /etc/ceph/
Eksekusi tahap 9 - 12 pada semua node
- Buat direktori untuk ceph-mon
sudo -u ceph mkdir /var/lib/ceph/mon/ceph-$(hostname)
- Inisiasi ceph-mon
sudo chown ceph:ceph /tmp/ceph.mon.keyring
sudo -u ceph ceph-mon --mkfs -i $(hostname) --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring
- Enable dan jalankan service ceph-mon
sudo systemctl enable --now ceph-mon@$(hostname)
sudo systemctl status ceph-mon@$(hostname)
- Periksa status cluster
sudo ceph -s
Menyiapkan Ceph Manager (ceph-mgr)
- Membuat keyring untuk ceph-mgr
sudo mkdir -p /var/lib/ceph/mgr/ceph-$(hostname)
sudo ceph auth get-or-create mgr.$(hostname) mon 'allow profile mgr' osd 'allow *' mds 'allow *' \
-o /var/lib/ceph/mgr/ceph-$(hostname)/keyring
- Mengubah kepemilikikan direktori
sudo chown -R ceph:ceph /var/lib/ceph/mgr
- Enable dan menjalankan service
sudo systemctl enable --now ceph-mgr@$(hostname)
sudo systemctl status ceph-mgr@$(hostname)
- Periksa status cluster
sudo ceph -s
Tahap 5 hanya perlu dilakukan disalah satu node
- Mengaktifkan modul msgr2
ceph mon enable-msgr2
Menyiapkan Ceph Object Storage Daemon (ceph-osd)
- Menyiapkan keyring untuk ceph-osd
# Eksekusi dari ceph01
sudo cp /var/lib/ceph/bootstrap-osd/ceph.keyring /tmp/ceph.keyring
sudo chown $USER:$USER /tmp/ceph.keyring
scp /tmp/ceph.keyring ceph02:/tmp/ceph.keyring
scp /tmp/ceph.keyring ceph03:/tmp/ceph.keyring
ssh ceph02 sudo -S cp /tmp/ceph.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring
ssh ceph03 sudo -S cp /tmp/ceph.keyring /var/lib/ceph/bootstrap-osd/ceph.keyring
sudo chown ceph:ceph /var/lib/ceph/bootstrap-osd/ceph.keyring
ssh ceph02 sudo chown ceph:ceph /var/lib/ceph/bootstrap-osd/ceph.keyring
ssh ceph03 sudo chown ceph:ceph /var/lib/ceph/bootstrap-osd/ceph.keyring
- Buat ceph-osd
# Eksekusi ceph01
sudo ceph-volume lvm create --bluestore --data /dev/vdb
sudo ceph-volume lvm create --bluestore --data /dev/vdc
sudo ceph-volume lvm create --bluestore --data /dev/vdd
# Eksekusi ceph02
sudo ceph-volume lvm create --bluestore --data /dev/vdb
sudo ceph-volume lvm create --bluestore --data /dev/vdc
sudo ceph-volume lvm create --bluestore --data /dev/vdd
# Eksekusi ceph03
sudo ceph-volume lvm create --bluestore --data /dev/vdb
sudo ceph-volume lvm create --bluestore --data /dev/vdc
sudo ceph-volume lvm create --bluestore --data /dev/vdd
Hasil
Ceph status
Ceph version