NFS Like Standalone Storage Server

From GlusterDocumentation

Jump to: navigation, search

Let us start with a simple volume specification to quickly get a functional setup. Once you are through, you can explore performance translators such as io-cache, write-behind, read-ahead, io-threads and so on. You can also add AFR (automatic file replication) to setup a high-availability NFS.

Server Volume Specification

# file: /etc/glusterfs/glusterfs-server.vol
volume brick
  type storage/posix
  option directory /data/export
end-volume

volume server
  type protocol/server
  option transport-type tcp/server
  option auth.ip.brick.allow *
  subvolumes brick
end-volume

Client Volume Specification

# file: /etc/glusterfs/glusterfs-client.vol
volume remote
  type protocol/client
  option transport-type tcp/client
  option remote-host storage.example.com
  option remote-subvolume brick
end-volume

How do I export more than one volume ?

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

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

volume blue
 type storage/posix               # POSIX FS translator
 option directory /home/blue      # Export this directory
end-volume

volume red
 type storage/posix               # POSIX FS translator
 option directory /home/red       # Export this directory
end-volume

volume server
 type protocol/server
 option transport-type tcp/server # For TCP/IP transport
 option client-volume-filename /etc/glusterfs/glusterfs-client.vol
 subvolumes export test
 option auth.ip.blue.allow *  # Allow access to "blue" volume
 option auth.ip.red.allow *   # Allow access to "red" volume
end-volume
$ emacs /etc/glusterfs/glusterfs-client.vol
$ cat /etc/glusterfs/glusterfs-client.vol

volume blue
 type protocol/client
 option transport-type tcp/client  # for TCP/IP transport
 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/client  # for TCP/IP transport
 option remote-host 192.168.0.1    # IP address of the remote brick
 option remote-subvolume red       # name of the remote volume
end-volume

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

$ glusterfs --server 192.168.0.1  /mnt/glusterfs_red/ --volume-name red

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

$ glusterfs --server 192.168.0.1 /mnt/glusterfs_blue/ --volume-name blue
Personal tools