How to create storage cluster for GlusterFS
Being a distributed filesystem, Gluster requires multiple servers to work. A Gluster filesystem is first achieved by creating a cluster of servers called Trusted Server Pool.
These servers need to have GlusterFS server package installed and configured before joining together. You can configure the Trusted Server Pool for GlusterFS from the terminal using the gluster tool.
Steps to create trusted server pool for GlusterFS:
-
Install glusterfs on all server nodes.
-
Launch terminal.
-
Open /etc/hosts file on all nodes using your preferred text editor.
$ sudo vi /etc/hosts [sudo] password for user:
-
Add static DNS name and optionally alias for all cluster nodes.
#IP Name Alias 192.168.111.70 node1.gluster.local node1 192.168.111.71 node2.gluster.local node2
-
Ping each nodes for all node to test if configuration is successful and nodes are reachable via network.
$ ping -c3 node1 PING node1.gluster.local (192.168.111.70) 56(84) bytes of data. 64 bytes from node1.gluster.local (192.168.111.70): icmp_seq=1 ttl=64 time=0.018 ms 64 bytes from node1.gluster.local (192.168.111.70): icmp_seq=2 ttl=64 time=0.020 ms 64 bytes from node1.gluster.local (192.168.111.70): icmp_seq=3 ttl=64 time=0.035 ms --- node1.gluster.local ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2029ms rtt min/avg/max/mdev = 0.018/0.024/0.035/0.007 ms $ ping -c3 node2.gluster.local PING node2.gluster.local (192.168.111.71) 56(84) bytes of data. 64 bytes from node2.gluster.local (192.168.111.71): icmp_seq=1 ttl=64 time=1.72 ms 64 bytes from node2.gluster.local (192.168.111.71): icmp_seq=2 ttl=64 time=0.626 ms 64 bytes from node2.gluster.local (192.168.111.71): icmp_seq=3 ttl=64 time=0.410 ms --- node2.gluster.local ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2015ms rtt min/avg/max/mdev = 0.410/0.919/1.722/0.574 ms
-
Create a Trusted Pool (Storage Cluster) from the first node by probing for all the other nodes.
$ sudo gluster peer probe node2 peer probe: success.
-
Check if peers were successfully added from any node.
$ sudo gluster peer status Number of Peers: 1 Hostname: node2 Uuid: 6770f88c-9ec5-4cf8-b9f5-658fa17b6bdc State: Peer in Cluster (Connected)
-
Check Trusted Pool status from any node.
$ sudo gluster pool list UUID Hostname State 6770f88c-9ec5-4cf8-b9f5-658fa17b6bdc node2 Connected bca7490b-64c2-46d1-ae9a-4577cc03625f localhost Connected