Skip to content

Instantly share code, notes, and snippets.

@carlosocarvalho
Last active June 12, 2020 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosocarvalho/ed56f18dfa4fe50033c941049186eb4a to your computer and use it in GitHub Desktop.
Save carlosocarvalho/ed56f18dfa4fe50033c941049186eb4a to your computer and use it in GitHub Desktop.
Configure - Vm Glusterfs

Format disk external

$ mkfs.xfs /dev/vdb

Set path for disk external for on boot mount automatic

Execute in all nodes(node1, node2,node3 ....)

$ mkdir /storage/bricks/1 -p
$ echo '/dev/vdb /storage/bricks/1 xfs defaults 0 0' >> /etc/fstab
$ mount -a
$ mkdir /store/bricks/1/brick

Check disks mounted

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda         18G  909M   17G   3% /
/dev/vdb         47G   80M   47G   1% /gluster/bricks/1

Install GlusterFs

$ apt update && sudo apt upgrade -y
$ apt install xfsprogs attr glusterfs-server glusterfs-common glusterfs-client -y
$ sudo systemctl start glusterd
$ sudo systemctl enable glusterd

Add Nodes in pool gluster

$ gluster peer probe node2
$ gluster peer probe node3

$ gluster pool list

UUID					Hostname 	State
a8107633-42fc-4f34-a34a-179591801781	node2	    Connected 
f307bad6-d8f3-40aa-90c1-0643a5a207cd	localhost	Connected 

Create the Replicated GlusterFS Volume

$ gluster volume create gv0 \
  replica 3 \
  node1:/storage/bricks/1/brick \
  node2:/storage/bricks/2/brick 
  

volume create: gv0: success: please start the volume to access data

$ gluster volume start gv0

$  gluster vol list
dev

List Volumes

$ gluster volume status gv0
Status of volume: gv0
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/storage/bricks/1/brick         49152     0          Y       6450
Brick node2:/storage/bricks/2/brick         49152     0          Y       3460

Security

$ gluster volume set gfs auth.allow 10.0.0.2,10.0.0.3,10.0.0.4

Mount the GlusterFS Volume to the Host

 echo 'localhost:/gv0 /mnt glusterfs defaults,_netdev,backupvolfile-server=localhost 0 0' >> /etc/fstab
$ mount.glusterfs localhost:/gv0 /mnt

Check

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda         18G  909M   17G   3% /
/dev/vdb         47G   80M   47G   1% /storage/bricks/1
localhost:/gv0   47G   80M   47G   1% /mnt

Configure for Suporte Docker

$ chown -R root:docker /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment