Lingkungan

  • Ubuntu 20.04 LTS Focal Fossa
  • Ceph 17.2.X Quincy

Panduan

Prasyarat (Semua Ceph Node)

  1. 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
  1. Memasang repository Ubuntu Cloud Archive (UCA) Focal-Yoga
sudo add-apt-repository cloud-archive:yoga
  1. 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

  1. 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
  1. Buat keyring ceph-mon
sudo ceph-authtool \
  --create-keyring /tmp/ceph.mon.keyring \
  --gen-key -n mon. --cap mon 'allow *'
  1. 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 *'
  1. 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'
  1. 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
  1. Mengubah kepimilikan berkas ceph.mon.keyring
sudo chown ceph:ceph /tmp/ceph.mon.keyring
  1. 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
  1. 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

  1. Buat direktori untuk ceph-mon
sudo -u ceph mkdir /var/lib/ceph/mon/ceph-$(hostname)
  1. 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
  1. Enable dan jalankan service ceph-mon
sudo systemctl enable --now ceph-mon@$(hostname)
sudo systemctl status ceph-mon@$(hostname)
  1. Periksa status cluster
sudo ceph -s

Menyiapkan Ceph Manager (ceph-mgr)

  1. 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
  1. Mengubah kepemilikikan direktori
sudo chown -R ceph:ceph /var/lib/ceph/mgr
  1. Enable dan menjalankan service
sudo systemctl enable --now ceph-mgr@$(hostname)
sudo systemctl status ceph-mgr@$(hostname)
  1. Periksa status cluster
sudo ceph -s

Tahap 5 hanya perlu dilakukan disalah satu node

  1. Mengaktifkan modul msgr2
ceph mon enable-msgr2

Menyiapkan Ceph Object Storage Daemon (ceph-osd)

  1. 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
  1. 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

Baca Juga

Referensi