Если вы видите что-то необычное, просто сообщите мне. Skip to main content

GlusterFS Setup

RequirementsТребования GlusterFS isподдерживает only supported onтолько 64bit systems,системы, soпоэтому makeубедитесь, sureчто theхостовая hostмашина machineможет runningзапустить GlusterFS andи anyлюбые machinesдругие utilisingмашины theиспользуют share is also running on aтоже 64bit system.системы.

ThisЭта guideинструкция isподоходит created forдля Ubuntu 22.04 jammy

StepsИнструкция toЗапустите followследующие Runкоманды theна followingвсех commandsсистемах, onкоторые allбудут systemsиспользоваться thatдля willраспределенной beфайловой utilisingсистемы.

the

Добавление share,хостов asв well/etc/hosts

as

Мы theхотим hostубедиться system.что наша машина может общаться друг с другом по именам, это можно сделать отредактировав следующим образом:

AddingРедактируем Hosts to /etc/hosts We want to make sure our machines can talk to each other via their host names, this can be done by editing and adding the following.

Edit /etc/hosts

sudo nano /etc/hosts

AddДобавьте inв yourнего IPваши addressesадреса andкоторые Hostnamesбудут ofиспользоваться yourмашинами, machinesниже thatприведен willпример beдля usingмоей машины GlusterFS, thisно isтакие myзаписи exampleнужно onбудет myдобавить GlusterFSна hostвсех machine,машинах butгде rememberбудет to add this to all your nodes that will be usingиспользоваться GlusterFS

127.0.0.1 localhost
127.0.1.1 elzim

192.168.68.109  elzim
192.168.68.105  pi4lab01
192.168.68.114  pi4lab02

Установка GlusterFS

InstallingНастроим GlusterFS Setupрепозиторий. theНа GlusterFSвремя repository.написания At the time of writing this,статьи GlusterFS-10 isпоследний the latest release.релиз.

sudo add-apt-repository ppa:gluster/glusterfs-10

RunЗапускаем anобновление apt update to update the repositories.репозиториев.

sudo apt update

Install GlusterFS

sudo apt install glusterfs-server -y

StartЗапускаем andи enableвключаем GlusterFS

sudo systemctl start glusterd
sudo systemctl enable glusterd

PeeringСвязываем theноды NodesЭто Thisкоманда commandзапускается isтолько onlyна runхостовой on the host machineмашине.

BeforeПеред runningзапуском theкоманды peeringсвязывания, command,убедитесь, makeчто sureвы youзапускаете runкоманды itот under sudo viasudo.

sudo -s

TheСледующая followingкоманда commandбудет willсвязывать peerвсе allноды theв nodesкластер toGlusterFS, theон GlusterFSиспользует Pool,имена thisуказанные isв usinghosts, theубедитесь, hostnamesчто forвы myвнесли environment,необходимые makeизменения sureв to change this to suit yours.скрипт.

gluster peer probe pi4lab01; 
gluster peer probe pi4lab02;

RunningЗапустите theкоманды belowкоторые commandпокажут willсвязанные showхосты yourв hosts now connected to the pool.кластер.

sudo gluster pool list

Creating the

Создание Gluster Volumeраздела

Let's

Давайте createсоздадим theдирректорию, directoryкоторая thatбудет willиспользоваться beв usedкачестве for theраздела GlusterFS

volume
-

Команда Thisниже isсоздается runна onвсех allнодах nodesкластера. Note: You can name "volumes" to anything you like.

sudo mkdir -p /gluster/volumes

NowТеперь weмы canможем createсоздать theраздел volumeна acrossвсех theнодах Glusterкластера. poolКоманда -выполняется Thisна is run just on the hostхосте.

sudo gluster volume create staging-gfs replica 3 elzim:/gluster/volumes pi4lab01:/gluster/volumes pi4lab02:/gluster/volumes force

StartЗапустим theраздел volumeзапустив byкоманду running the below commandниже

sudo gluster volume start staging-gfs

ToЧтобы ensureубедиться, theчто volumeраздел automaticallyавтоматически mountsпримонтируется onпри rebootперезагрузе orили otherдругих circumstances,обстоятельствах, followнужно theseвыполнить stepsследующие onшаги allна machines:всех машинах:

SwitchПереключитесь toна theсупер rootпользователя:

user by running:
sudo -s
.
Append

Добаврьте theследующие followingстроки line to theв /etc/fstab fileфайл usingиспользуя theкоманду

command:
echo 'localhost:/staging-gfs /mnt glusterfs defaults,_netdev,backupvolfile-server=localhost 0 0' >> /etc/fstab
.
Mount

Примонтируйте theраздел GlusterFS volume to theк /mnt directoryдиректории withс theпомощью command:команды:

mount.glusterfs localhost:/staging-gfs /mnt
.
Set

Установите the ownership of theвладельца /mnt directoryдирректории andи itsего contents toсодержимого root:docker using:используя команду:

chown -R root:docker /mnt
.
Exit

Выйдите theиз rootрута

user
exit
session
by

Чтобы running:проверить, exit. To verify that theчто GlusterFS volumeраздел isуспешно successfullyсмонтирован, mounted,запустите runкоманду:

the command:
df -h.

localhost:/staging-gfs                 15G  4.8G  9.1G  35% /mnt

FilesФайлы createdсозданные inв theпапке /mnt directoryбудут willтеперь nowотображаться showво upвсех inмашинах the/gluster/volumesгде directorieзапущен on every machine.GlusterFS.