To set up a high-availability storage with two storage servers (Ubuntu 11.10) that use GlusterFS.
Each storage server will be a mirror of the other storage server, and
files will be replicated automatically across both storage servers. The
client system (Ubuntu 11.10 as well) will be able to access the storage
as if it was a local filesystem.
GlusterFS is a clustered file-system capable of scaling to several
peta-bytes. It aggregates various storage bricks over Infiniband RDMA or
TCP/IP interconnect into one large parallel network file system.
Storage bricks can be made of any commodity hardware such as x86_64
servers with SATA-II RAID and Infiniband HBA.
All three systems should be able to resolve the other systems' hostnames. If this cannot be done through DNS, you should edit the /etc/hosts file so that it looks as follows on all three systems:
test by
glusterfsd --version
make the both servers peer with each other
on server2
sudo gluster peer probe server1
on server 1
sudo gluster peer probe server2
Check the status of peer by
sudo gluster peer
we create the share named testvol with two replicas (please note that the number of replicas is equal to the number of servers in this case because we want to set up mirroring) on server1 and server2 in the /gluster-fs-directory directory (this will be created if it doesn't exist)
sudo gluster volume create testvol replica 2 transport tcp server1:/gluster-fs-directory server2.example.com:/gluster-fs-directory
Start the volume
sudo gluster volume start testvol
You can check the status of the volume with the command
By default, all clients can connect to the volume. If you want to grant access to client1= 192.168.0.102) only, run:
Now you are done with glusterfs server
1 Preliminary Note
- server1: IP address 192.168.0.100 (server)
- server2: IP address 192.168.0.101 (server)
- client1: IP address 192.168.0.102 (client)
All three systems should be able to resolve the other systems' hostnames. If this cannot be done through DNS, you should edit the /etc/hosts file so that it looks as follows on all three systems:
vi /etc/hosts
127.0.0.1 localhost.localdomain 192.168.0.100 server1.example.com 192.168.0.101 server2.example.com 192.168.0.102 client1.example.com
2 Setting Up The GlusterFS Server
Setup GlusterFs on both machine. GlusterFS is available as a package for Ubuntu, therefore we can install it as follows:
sudo apt-get install glusterfs-server
test by
glusterfsd --version
make the both servers peer with each other
on server2
sudo gluster peer probe server1
on server 1
sudo gluster peer probe server2
Check the status of peer by
sudo gluster peer
we create the share named testvol with two replicas (please note that the number of replicas is equal to the number of servers in this case because we want to set up mirroring) on server1 and server2 in the /gluster-fs-directory directory (this will be created if it doesn't exist)
sudo gluster volume create testvol replica 2 transport tcp server1:/gluster-fs-directory server2.example.com:/gluster-fs-directory
Start the volume
sudo gluster volume start testvol
You can check the status of the volume with the command
sudo gluster volume info
sudo gluster volume set testvol auth.allow 192.168.0.102
Please note that it is possible to use wildcards for the IP addresses (like 192.168.*) and that you can specify multiple IP addresses separated by comma (e.g. 192.168.0.102,192.168.0.103).
Now you are done with glusterfs server
No comments:
Post a Comment