%BOOK_ENTITIES; ]> Accessing Data - Setting Up GlusterFS Client Gluster volumes can be accessed in multiple ways. One can use Gluster Native Client method for high concurrency, performance and transparent failover in GNU/Linux clients. Gluster exports volumes using NFS v3 protocol too. CIFS can also be used to access volumes by exporting the Gluster Native mount point as a samba export.
Gluster Native Client The Gluster Native Client is a FUSE-based client running in user space. Gluster Native Client is the recommended method for accessing volumes if all the clustered features of GlusterFS has to be utilized. This section introduces the Gluster Native Client and explains how to install the software on client machines. This section also describes how to mount volumes on clients (both manually and automatically).
Installing the Gluster Native Client Gluster Native Client has a dependancy on FUSE module. To make sure FUSE module is loaded, execute below commands: Add the FUSE loadable kernel module (LKM) to the Linux kernel: # modprobe fuse Verify that the FUSE module is loaded: # dmesg | grep -i fuse fuse init (API version 7.13)
Installing on RPM Based Distributions To install Gluster Native Client on RPM distribution-based systems Install required prerequisites on the client using the following command: $ sudo yum -y install fuse fuse-libs Download the latest glusterfs, glusterfs-fuse RPM files on each client. The glusterfs package contains the GlusterFS Binary and required libraries. The glusterfs-fuse package contains the FUSE plugin (in GlusterFS terms, its called Translator) required for mounting. Install 'glusterfs-rdma' RPM if RDMA support is required. 'glusterfs-rdma' contains RDMA transport module for Infiniband interconnect. You can download the software at . Install Gluster Native Client on the client. $ sudo rpm -i glusterfs-3.3.0-1.x86_64.rpm $ sudo rpm -i glusterfs-fuse-3.3.0-1.x86_64.rpm $ sudo rpm -i glusterfs-rdma-3.3.0-1.x86_64.rpm
Installing on Debian-based Distributions To install Gluster Native Client on Debian-based distributions Download the latest GlusterFS .deb file. You can download the software at . Uninstall GlusterFS v3.1.x/v3.2.x (or an earlier version) from the client using the following command: $ sudo dpkg -r glusterfs (Optional) Run $ sudo dpkg -purge glusterfs to purge the configuration files. Install Gluster Native Client on the client using the following command: $ sudo dpkg -i glusterfs-$version.deb For example: $ sudo dpkg -i glusterfs-3.3.0.deb
Performing a Source Installation To build and install Gluster Native Client from the source code Create a new directory using the following commands: # mkdir glusterfs # cd glusterfs Download the source code. You can download the source at . Extract the source code using the following command: # tar -xvzf glusterfs-3.3.0.tar.gz Run the configuration utility using the following command: # ./configure ... GlusterFS configure summary =========================== FUSE client : yes Infiniband verbs : yes epoll IO multiplex : yes argp-standalone : no fusermount : no readline : yes The configuration summary shown above is sample, it can vary depending on other packages. Build the Gluster Native Client software using the following commands: # make # make install Verify that the correct version of Gluster Native Client is installed, using the following command: # glusterfs –-version
Mounting Volumes After installing the Gluster Native Client, you need to mount Gluster volumes to access data. There are two methods you can choose: After mounting a volume, you can test the mounted volume using the procedure described in . Server names selected during creation of Volumes should be resolvable in the client machine. You can use appropriate /etc/hosts entries or DNS server to resolve server names to IP addresses.
Manually Mounting Volumes To manually mount a Gluster volume To mount a volume, use the following command: # mount -t glusterfs HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR For example: # mount -t glusterfs server1:/test-volume /mnt/glusterfs The server specified in the mount command is only used to fetch the gluster configuration volfile describing the volume name. Subsequently, the client will communicate directly with the servers mentioned in the volfile (which might not even include the one used for mount).
Automatically Mounting Volumes To automatically mount a Gluster volume To mount a volume, edit the /etc/fstab file and add the following line: HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR glusterfs defaults,_netdev 0 0 For example: server1:/test-volume /mnt/glusterfs glusterfs defaults,_netdev 0 0 Mounting Options You can specify the following options when using the mount -t glusterfs command. Note that you need to separate all options with commas. backupvolfile-server=server-name fetch-attempts=N (where N is number of attempts) log-level=loglevel log-file=logfile direct-io-mode=[enable|disable] ro (for readonly mounts) acl (for enabling posix-ACLs) worm (making the mount WORM - Write Once, Read Many type) selinux (enable selinux on GlusterFS mount) enable-ino32 (enable to use 32-bit inodes) For example: # mount -t glusterfs -o backupvolfile-server=volfile_server2,fetch-attempts=2,log-level=WARNING,log-file=/var/log/gluster.log server1:/test-volume /mnt/glusterfs Using /etc/fstab, options would look like below: HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR glusterfs defaults,_netdev,log-level=WARNING,log-file=/var/log/gluster.log 0 0 If option is added while mounting fuse client, when the first volfile server fails, then the server specified in option is used as volfile server to mount the client. In fetch-attempts=N option, specify the number of attempts to fetch volume files while mounting a volume. This option will be useful when round-robin DNS is configured for the server-name.
NFS You can use NFS v3 to access to gluster volumes. GlusterFS 3.3.0, now includes network lock manager (NLM) v4 feature too. NLM enables applications on NFSv3 clients to do record locking on files. NLM program is started automatically with the NFS server process. This section describes how to use NFS to mount Gluster volumes (both manually and automatically).
Using NFS to Mount Volumes You can use either of the following methods to mount Gluster volumes: After mounting a volume, you can test the mounted volume using the procedure described in .
Manually Mounting Volumes Using NFS To manually mount a Gluster volume using NFS To mount a volume, use the following command: # mount -t nfs -o vers=3 HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR For example: # mount -t nfs -o vers=3 server1:/test-volume /mnt/glusterfs Gluster NFS server does not support UDP. If the NFS client you are using defaults to connecting using UDP, the following message appears: requested NFS version or transport protocol is not supported. To connect using TCP Add the following option to the mount command: -o mountproto=tcp For example: # mount -o mountproto=tcp,vers=3 -t nfs server1:/test-volume /mnt/glusterfs To mount Gluster NFS server from a Solaris client Use the following command: # mount -o proto=tcp,vers=3 nfs://HOSTNAME-OR-IPADDRESS:38467/VOLNAME MOUNTDIR For example: # mount -o proto=tcp,vers=3 nfs://server1:38467/test-volume /mnt/glusterfs
Automatically Mounting Volumes Using NFS You can configure your system to automatically mount Gluster volumes using NFS each time the system starts. To automatically mount a Gluster volume using NFS To mount a volume, edit the /etc/fstab file and add the following line: HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR nfs defaults,_netdev,vers=3 0 0 For example, server1:/test-volume /mnt/glusterfs nfs defaults,_netdev,vers=3 0 0 If default transport to mount NFS is UDP, use below line in fstab server1:/test-volume /mnt/glusterfs nfs defaults,_netdev,mountproto=tcp 0 0 To automount NFS mounts Gluster supports *nix standard method of automounting NFS mounts. Update the /etc/auto.master and /etc/auto.misc and restart the autofs service. After that, whenever a user or process attempts to access the directory it will be mounted in the background.
CIFS You can use CIFS to access to volumes when using Microsoft Windows as well as SAMBA clients. For this access method, Samba packages need to be present on the client side. You can export glusterfs mount point as the samba export, and then mount it using CIFS protocol. This section describes how to mount CIFS shares on Microsoft Windows-based clients (both manually and automatically) and how to verify that the volume has mounted successfully. CIFS access using the Mac OS X Finder is not supported, however, you can use the Mac OS X command line to access Gluster volumes using CIFS.
Using CIFS to Mount Volumes You can use either of the following methods to mount Gluster volumes: After mounting a volume, you can test the mounted volume using the procedure described in . You can also use Samba for exporting Gluster Volumes through CIFS protocol.
Exporting Gluster Volumes Through Samba We recommend you to use Samba for exporting Gluster volumes through the CIFS protocol. To export volumes through CIFS protocol Mount a Gluster volume. For more information on mounting volumes, see . Setup Samba configuration to export the mount point of the Gluster volume. For example, if a Gluster volume is mounted on /mnt/gluster, you must edit smb.conf file to enable exporting this through CIFS. Open smb.conf file in an editor and add the following lines for a simple configuration: [glustertest] comment = For testing a Gluster volume exported through CIFS path = /mnt/glusterfs read only = no guest ok = yes Save the changes and start the smb service using your systems init scripts (/etc/init.d/smb [re]start). To be able mount from any server in the trusted storage pool, you must repeat these steps on each Gluster node. For more advanced configurations, see Samba documentation.
Manually Mounting Volumes Using CIFS You can manually mount Gluster volumes using CIFS on Microsoft Windows-based client machines. To manually mount a Gluster volume using CIFS Using Windows Explorer, choose Tools > Map Network Drive… from the menu. The Map Network Drive window appears. Choose the drive letter using the Drive drop-down list. Click Browse, select the volume to map to the network drive, and click OK. Click Finish. The network drive (mapped to the volume) appears in the Computer window. Alternatively, to manually mount a Gluster volume using CIFS. Click Start > Run and enter the following: \\SERVERNAME\VOLNAME For example: \\server1\test-volume
Automatically Mounting Volumes Using CIFS You can configure your system to automatically mount Gluster volumes using CIFS on Microsoft Windows-based clients each time the system starts. To automatically mount a Gluster volume using CIFS The network drive (mapped to the volume) appears in the Computer window and is reconnected each time the system starts. Using Windows Explorer, choose Tools > Map Network Drive… from the menu. The Map Network Drive window appears. Choose the drive letter using the Drive drop-down list. Click Browse, select the volume to map to the network drive, and click OK. Click the Reconnect at logon checkbox. Click Finish.
Testing Mounted Volumes To test mounted volumes Use the following command: # mount If the gluster volume was successfully mounted, the output of the mount command on the client will be similar to this example: server1:/test-volume on /mnt/glusterfs type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072 Use the following command: # df -h The output of df command on the client will display the aggregated storage space from all the bricks in a volume similar to this example: # df -h /mnt/glusterfs Filesystem Size Used Avail Use% Mounted on server1:/test-volume 28T 22T 5.4T 82% /mnt/glusterfs Change to the directory and list the contents by entering the following: # cd MOUNTDIR # ls For example, # cd /mnt/glusterfs # ls