NFS Like Standalone Storage Server-2

From GlusterDocumentation

This information is out of date
and does not contain information related to the current version of Gluster

Documentation Home


  • How do I export more than one volume in glusterfs server, like I give in NFS /etc/exports file.

You may need to export more than one directory, the below volfile example shows how you could do this with two directories, /home/blue/ and /home/red/.

There are potentially two methods out there to achieve this behavior. One is having seperate volfile for each export and use --volume-id option to fetch corresponding file, or to have both volumes defined in a single volfile and use --volume-name option to mount

$ emacs /etc/glusterfs/glusterfs-server.vol
$ cat /etc/glusterfs/glusterfs-server.vol

volume blue
 type storage/posix               
 option directory /home/blue      
end-volume

volume red
 type storage/posix               
 option directory /home/red       
end-volume

volume server
 type protocol/server
 option transport-type tcp/server 
 option client-volume-filename /etc/glusterfs/glusterfs-client.vol
 option volume-filename.blue-key /etc/glusterfs/blue.vol
 option volume-filename.red-key /etc/glusterfs/red.vol
 subvolumes blue red
 option auth.addr.blue.allow *  
 option auth.addr.red.allow *   
end-volume
$ emacs /etc/glusterfs/glusterfs-client.vol
$ cat /etc/glusterfs/glusterfs-client.vol

volume blue
 type protocol/client
 option transport-type tcp
 option remote-host 192.168.0.1    # IP address of the remote brick
 option remote-subvolume blue      # name of the remote volume
end-volume

volume red
 type protocol/client
 option transport-type tcp
 option remote-host 192.168.0.1    # IP address of the remote brick
 option remote-subvolume red       # name of the remote volume
end-volume
$ emacs /etc/glusterfs/red.vol
$ cat /etc/glusterfs/red.vol

volume red
 type protocol/client
 option transport-type tcp
 option remote-host 192.168.0.1    # IP address of the remote brick
 option remote-subvolume red       # name of the remote volume
end-volume
$ emacs /etc/glusterfs/blue.vol
$ cat /etc/glusterfs/blue.vol

volume blue
 type protocol/client
 option transport-type tcp
 option remote-host 192.168.0.1    # IP address of the remote brick
 option remote-subvolume blue       # name of the remote volume
end-volume


On a client machine you can now mount a selected volume (red in this case):

bash# glusterfs --volfile-server 192.168.0.1 --volume-name red /mnt/glusterfs_red
or 
bash# glusterfs --volfile-server 192.168.0.1 --volume-id red-key /mnt/glusterfs_red

To mount the blue volume on the same (or another) client machine:

bash# glusterfs --volfile-server 192.168.0.1 --volume-name blue /mnt/glusterfs_blue
or
bash# glusterfs --volfile-server 192.168.0.1 --volume-id blue-key /mnt/glusterfs_blue
  • the option 'client-volume-filename' works as the default option if --volume-id is not provided in command line.
  • if --volume-name argument is not given in command line, glusterfs will take the last volume as the default volume.

This information is out of date
and does not contain information related to the current version of Gluster

Documentation Home

 

Copyright © Gluster, Inc. All Rights Reserved.