The software described in this documentation is either no longer supported or is in extended support.
Oracle recommends that you upgrade to a current supported release.
You can expose Gluster volumes using the Common Internet File System (CIFS) or Server Message Block (SMB) by using Samba. This file sharing service is commonly used on Microsoft Windows systems.
Gluster provides hooks to preconfigure and export Gluster volumes automatically using a Samba Virtual File System (VFS) module plug-in. This reduces the complexity of configuring Samba to export the shares and also means that you do not have to pre-mount the volumes using the FUSE client, resulting in some performance gains. The hooks are triggered every time a volume is started, so your Samba configuration is updated the moment a volume is started within Gluster.
For more information on Samba, see the Oracle Linux 7 Administrator's Guide at:
https://docs.oracle.com/cd/E52668_01/E54669/html/ol7-about-samba.html
This section discusses setting up the nodes in the trusted
storage pool to enable access to a volume by a Samba client.
To use this service, you must make sure both the
samba and
samba-vfs-glusterfs packages are installed
on any of the nodes in the pool where you intend a client to
connect to the volume using Samba.
To set up the volume for Samba access:
On each node in the trusted storage pool on which you want to enable Samba access:
Install the Samba packages for Gluster:
#
yum install samba samba-vfs-glusterfsIf you are running a firewall service, enable access to Samba on the node. For example:
#
firewall-cmd --permanent --add-service=samba#firewall-cmd --reloadEnable and start the Samba service:
#
systemctl enable --now smb(Optional) If you do not have an authentication system configured (for example, an LDAP server), you can create a Samba user to enable access to the Samba share from clients. This user should be created on all nodes set up to export the Samba share. For example:
#
adduser#myusersmbpasswd -aNew SMB password: Retype new SMB password: Added user myuser.myuserRestart the Samba service:
#
systemctl restart smb(Optional) If you want to allow guest access to a Samba share (no authentication is required), add a new line containing
map to guest = Bad Userto the[global]section of the/etc/samba/smb.conffile on each node set up to export the Samba share. For example:[global] workgroup = SAMBA security = user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw map to guest = Bad UserAllowing guest access also requires that the
[gluster-section contains thevolume_name]guest ok = yesoption, which is set automatically with the Gluster hook scripts in the next step.Restart the Samba service:
#
systemctl restart smbIf you have a running Gluster volume, stop it and start it again. On any node in the trusted storage pool, run:
#
gluster volume stop#myvolumegluster volume startmyvolumeWhen you start a Gluster volume, a Gluster hook is triggered to automatically add a configuration entry for the volume to the
/etc/samba/smb.conffile on each node, and to reload the Samba service. This script generates a Samba configuration entry similar to the following:[gluster-
myvolume] comment = For samba share of volumemyvolumevfs objects = glusterfs glusterfs:volume =myvolumeglusterfs:logfile = /var/log/samba/glusterfs-myvolume.%M.log glusterfs:loglevel = 7 path = / read only = no guest ok = yes kernel share modes = noNoteThe value of the
[gluster-entry sets the name you use to connect to the Samba share in the connection string.myvolume](Optional) If you do not want Gluster to automatically configure Samba to export shares for Gluster volumes, you can remove or rename the hook scripts that control this behavior. On each node on which you want to disable the Samba shares, rename the hook scripts, for example:
#
rename S30 disabled-S30 $(find /var/lib/glusterd -type f -name S30samba*)To re-enable the hooks, you can run:
#
rename disabled-S30 S30 $(find /var/lib/glusterd -type f -name *S30samba*)Disable enforcing mode on SELinux for any node where you have set up Samba access:
#
setenforce 0To make this change permanent, edit the
/etc/selinux/configfile and change theSELINUXvariable topermissivemode.
This section discusses testing SMB access to a volume that has been set up to export a Samba share. You can test SMB access to the volume from an Oracle Linux host. This host does not need to be part of the Gluster pool.
To test access to the volume using SMB:
On an Oracle Linux host, install the Samba client package:
#
yum install samba-clientUse the smbclient command to list Samba shares on a node in the trusted storage pool where you set up Samba. For example:
#
smbclient -N -U% -Lnode1To look directly at the contents of the volume, you can do:
#
smbclient -N -U%//node1/gluster-myvolume-c lsIn this command, you specify the Samba share name for the Gluster volume. This name can be found on a host where you set up the Samba share, in the
/etc/samba/smb.conffile. Usually the Samba share name isgluster-.volume_name
This section discusses testing CIFS access to a volume that has been set up to export a Samba share. You can test CIFS access to the volume from an Oracle Linux host. This host does not need to be part of the Gluster pool.
To test access to the volume using CIFS:
On an Oracle Linux host, install the
cifs-utilspackage:#
yum install cifs-utilsCreate a mount directory where you intend to mount the volume. For example:
#
mkdir /gluster-storageMount the volume on the directory using the
cifsmount type and by specifying a node within the pool, along with the Samba share name for the Gluster volume. This name can be found on a host where you set up the Samba share, in the/etc/samba/smb.conffile. Usually the Samba share name isgluster-. For example:volume_name#
mount -t cifs -o guest //node1/gluster-myvolume/gluster-storageIf you have set up the volume to enable mounting a subdirectory, you can add the subdirectory name to the path on the Gluster file system:
#
mount -t cifs -o guest //node1/gluster-myvolume/subdirectory/gluster-storageIf you want to pass authentication credentials to the Samba share, first add them to a local file. In this example, the credentials are saved to the file
/credfile.username=
valuepassword=valueSet the permissions on the credentials file so other users cannot access it.
# chmod 600 /
credfileYou can then use the credentials file to connect to the Samba share, for example:
#
mount -t cifs -o credentials=/credfile//node1/gluster-myvolume/gluster-storageCheck the permissions on the new mount to make sure the appropriate users can read and write to the storage. For example:
#
chmod 777 /gluster-storage
On a Microsoft Windows host, you can mount the Gluster volume
using the Samba share. By default, the Samba share is
available in the Workgroup named SAMBA (as
defined in the /etc/samba/smb.conf file
on Samba share nodes).
You can map the Gluster volume by mapping a network drive
using Windows Explorer using the format:
\\,
for example:
node\volume
\\node1\gluster-myvolume
Alternatively, you can map a new drive using the Windows command line. Start the Command Prompt. Enter a command similar to the following:
net usez: \\node1\gluster-myvolume

