Ми будемо виконувати встановлення GlusterFS на 3 вузли і використовувати фактор реплікації рівний трьом. Це дозволяє втратити будь-який з вузлів і при цьому не зіткнутися з ситуацією split-brain, яка характерна для зберігання даних з фактором реплікації рівним 2, коли кожна копія може вважати себе правильною і продовжувати функціонувати, накопичуючи неузгодженості.
Встановити сервер NTPD кожному з вузлів:
sudo yum install -y ntp
sudo systemctl start ntpd
sudo systemctl enable ntpd
Створимо директорію:
mkdir /app/glusterfs
встановлюємо та включаємо glusterfs
yum -y install centos-release-gluster9 && yum -y install glusterfs-server
sudo systemctl enable glusterd && sudo systemctl start glusterd
Установка на Oracle Linux 8
dnf install oracle-gluster-release-el8 -y
dnf install @glusterfs/server -y
dnf install @glusterfs/client -y
Додаємо до /etc/hosts
172.17.11.149 SRV-TT-DCR21.wiset.pp.ua SRV-TT-DCR21
172.17.11.114 SRV-TT-DCR22.wiset.pp.ua SRV-TT-DCR22
172.17.11.160 SRV-TT-DCR23.wiset.pp.ua SRV-TT-DCR23
Для додавання до пулу вузлів необхідно на будь-якому з вузлів виконати команду
На ноді якої ми знаходимося додають у пул не потрібно
gluster peer probe srv-tt-dcr22
gluster peer probe srv-tt-dcr23
Переглянути додані до пулу вузли можна командою:
sudo gluster pool list
Висновок буде наступний:
UUID Hostname State
5b8a7fe5-47ae-477e-b3a6-bb0ecd330dcf srv-tt-dcr22 Connected
e09e9778-128a-4234-9de3-8d6582675b76 srv-tt-dcr23 Connected
247fe625-9417-4dac-bdcc-c1f03f790224 localhost Connected
Тепер, коли всі сервери знаходяться в пулі, можна створити том для зберігання даних.
У нашому випадку ми вказуємо 3 репліки
gluster volume create dcrttgfs replica 3 srv-tt-dcr2{1,2,3}:/app/glusterfs force
На ноді srv-tt-dcr21
виконуємо переконавшись, що створився том.
gluster volume list
Висновок буде:
dcrttgfs
Для активації тому dcrttgfs
gluster volume start dcrttgfs
Перевірити стан тома:
gluster volume info all
Висновок буде наступний:
``yaml
Volume Name: dcrttgfs
Type: Replicate
Volume ID: feb7c9a4-4cf1-4551-9e22-689292cb9fbc
Status: Started
Snapshot Count: 0
Номер брикетів: 1 x 3 = 3
Transport-type: tcp
Bricks:
Brick1: srv-tt-dcr21:/app/glusterfs
Brick2: srv-tt-dcr22:/app/glusterfs
Brick3: srv-tt-dcr23:/app/glusterfs
Options Reconfigured:
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
## Змінні:
Більше змінних [тут](https://access.redhat.com/documentation/en-us/red_hat_gluster_storage/3.1/html/administration_guide/chap-managing_red_hat_storage_volumes)
`gluster volume set dcrttgfs network.ping-timeout 5` - період після якого нода вважається не доступна. (За замовчуванням 42 сек.)
`gluster volume set dcrttgfs cluster.quorum-type fixed` - дозволяє писати у файл якщо значення >= значення `cluster.quorum-count`
`gluster volume set dcrttgfs cluster.quorum-count 1` - мінімальна кількість блоків, які повинні бути активними в наборі реплік, щоб дозволити запис
`gluster volume set dcrttgfs performance.quick-read on` - швидке читання даних
Встановіть для параметра quorum-type значення auto, щоб дозволити запис у файл лише в тому випадку, якщо відсоток активних блоків реплікації перевищує 50% від загальної кількості блоків, що становлять цю репліку
gluster volume set VOLNAME quorum-type auto
Більш детально про це описано [тут](https://access.redhat.com/documentation/en-us/red_hat_gluster_storage/3.5/html/administration_guide/sect-managing_split-brain)
## Доступ до того:
> Повторюємо на всіх нодах
{.is-info}
Створюємо директорію
```shell
mkdir -p /app/glusterfs-mounts/dcrttgfs
Монтуємо том у ручному режимі, виконавши на кожній ноді
.
mount.glusterfs SRV-TT-DCR22:/dcrttgfs /app/glusterfs-mounts/dcrappgfs
Перевіряємо додавання файлу, має з'явитися на всіх нодах.
echo "222" > /app/glusterfs-mounts/dcrappgfs/test.txt
Додаємо в /etc/fstab
кожної ноди
і перевантажуємо по чергову.
SRV-TT-DCR21:/dcrttgfs /app/glusterfs-mounts/dcrttgfs glusterfs defaults,_netdev 0 0
gluster peer probe srv-tt-dcr05
mkdir /app/glusterfs
mkdir -p /app/glusterfs-mounts/dcrttgfs
Дивимося інформацію по volume gluster volume info
``yaml
Volume Name: dcrttgfs
Type: Replicate
Volume ID: e380e491-4d25-4cef-a549-eb9743e309dc
Status: Started
Snapshot Count: 0
Номер бриків: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: srv-tt-dcr01:/app/glusterfs
Brick2: srv-tt-dcr02:/app/glusterfs
Brick3: srv-tt-dcr03:/app/glusterfs
Brick4: srv-tt-dcr04:/app/glusterfs
Options Reconfigured:
performance.quick-read: on
cluster.quorum-count: 1
cluster.quorum-type: fixed
network.ping-timeout: 5
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
cluster.server-quorum-ratio: 51%
Додаємо `brick`
gluster volume add-brick dcrttgfs replica 5 srv-tt-dcr05:/app/glusterfs
якщо при додаванні `brick` видає помилку:
> volume add-brick: failed: /app/glusterfs is already part of a volume
{.is-warning}
тоді додаємо `force`:
gluster volume add-brick dcrttgfs replica 5 srv-tt-dcr05:/app/glusterfs force
Дивимося зміни по volume `gluster volume info`
``yaml
Volume Name: dcrttgfs
Type: Replicate
Volume ID: e380e491-4d25-4cef-a549-eb9743e309dc
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 5 = 5
Transport-type: tcp
Bricks:
Brick1: srv-tt-dcr01:/app/glusterfs
Brick2: srv-tt-dcr02:/app/glusterfs
Brick3: srv-tt-dcr03:/app/glusterfs
Brick4: srv-tt-dcr04:/app/glusterfs
Brick5: srv-tt-dcr05:/app/glusterfs
Options Reconfigured:
performance.quick-read: on
cluster.quorum-count: 1
cluster.quorum-type: fixed
network.ping-timeout: 5
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
cluster.server-quorum-ratio: 51%
Монтуємо в /etc/fstab
SRV-TT-DCR05:/dcrttgfs /app/glusterfs-mounts/dcrttgfs glusterfs defaults,_netdev 0 0
gluster volume get dcrttgfs all
- виведення всіх значень змінних для розділу dcrttgfs
gluster volume get dcrttgfs auth.allow
- виведення значення певної змінної
Стаття взята за цією посиланням