Linux/GlusterFS: Difference between revisions

From Wiki
 
(9 intermediate revisions by the same user not shown)
Line 15: Line 15:
== Create Volume ==
== Create Volume ==
<pre>
<pre>
gluster volume create storage-config replica 2 vm-docker0:/mnt/gluster_storage-config vm-docker1:/mnt/gluster_storage-config force
gluster volume create docker-config replica 2 vm-docker0:/mnt/gluster_docker-config vm-docker1:/mnt/gluster_docker-config force
gluster volume create docker-data replica 2 vm-docker0:/mnt/gluster_docker-data vm-docker1:/mnt/gluster_docker-data force


gluster volume start storage-config


gluster volume start docker-config
gluster volume start docker-data


gluster volume status
</pre>
== Connect client to volume ==
<pre>
mount -t glusterfs vm-docker0:/docker-config /srv/docker-config
mount -t glusterfs vm-docker0:/docker-data /srv/docker-data
</pre>
* fstab
<pre>
vm-docker0:/docker-config /srv/docker-config glusterfs defaults,_netdev 0 0
vm-docker0:/docker-data /srv/docker-data glusterfs defaults,_netdev 0 0
</pre>
* systemd (often fstab is loaded before gluster, therefore not mounting gluster shares)
* /etc/systemd/system/gluster-mounts.service
<pre>
cd /etc/systemd/system
touch gluster-mounts.service
[Unit]
Description=GlusterFS mounting
Requires=glusterd.service
[Service]
Type=simple
RemainAfterExit=true
ExecStartPre=/usr/sbin/gluster volume list
ExecStart=/bin/mount -a -t glusterfs
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target
</pre>
<pre>
systemctl daemon-reload
systemctl enable gluster-mounts
</pre>
== Infos ==
<pre>
gluster peer status
gluster volume list
gluster volume status
gluster volume info
gluster volume profile {volume_name} start
gluster volume profile {volume_name} start
</pre>
</pre>



Latest revision as of 22:32, 18 December 2021

Server Setup

apt install glusterfs-client glusterfs-server

systemctl enable glusterd
systemctl start glusterd

gluster peer probe node1
gluster peer probe node2
...

gluster peer status

Create Volume

gluster volume create docker-config replica 2 vm-docker0:/mnt/gluster_docker-config vm-docker1:/mnt/gluster_docker-config force
gluster volume create docker-data replica 2 vm-docker0:/mnt/gluster_docker-data vm-docker1:/mnt/gluster_docker-data force


gluster volume start docker-config
gluster volume start docker-data


gluster volume status

Connect client to volume

mount -t glusterfs vm-docker0:/docker-config /srv/docker-config
mount -t glusterfs vm-docker0:/docker-data /srv/docker-data
  • fstab
vm-docker0:/docker-config /srv/docker-config glusterfs defaults,_netdev 0 0
vm-docker0:/docker-data /srv/docker-data glusterfs defaults,_netdev 0 0

  • systemd (often fstab is loaded before gluster, therefore not mounting gluster shares)
  • /etc/systemd/system/gluster-mounts.service
cd /etc/systemd/system
touch gluster-mounts.service

[Unit]
Description=GlusterFS mounting
Requires=glusterd.service

[Service]
Type=simple
RemainAfterExit=true
ExecStartPre=/usr/sbin/gluster volume list
ExecStart=/bin/mount -a -t glusterfs
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable gluster-mounts

Infos

gluster peer status

gluster volume list
gluster volume status
gluster volume info

gluster volume profile {volume_name} start
gluster volume profile {volume_name} start