4.3. Configuring Samba
The following procedure initializes the Samba environment and configures Samba on the cluster nodes.
- On both nodes of the cluster, perform the following steps:
- Install the
samba,ctdb, andcifs-utilspackages.yum install samba ctdb cifs-utils
# yum install samba ctdb cifs-utilsCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you are running the
firewallddaemon, run the following commands to enable the ports that are required by thectdbandsambaservices.firewall-cmd --add-service=ctdb --permanent firewall-cmd --add-service=samba --permanent firewall-cmd --reload
# firewall-cmd --add-service=ctdb --permanent # firewall-cmd --add-service=samba --permanent # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Enter the following commands to ensure that these daemons are not running and do not start at bootup. Note that not all of these daemons may be present or running on your system.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In the
/etc/samba/smb.conffile, configure the Samba server and set up the[public]share definition. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For information on configuring Samba as a standalone server, as in this example, as well as information on verifying thesmb.conffile with thetestparmutility, see the File and Print Servers section of the System Administrator's Guide - Add the IP address of the cluster nodes to the
/etc/ctdb/nodesfile.cat << END > /etc/ctdb/nodes 192.168.1.151 192.168.1.152 END
# cat << END > /etc/ctdb/nodes 192.168.1.151 192.168.1.152 ENDCopy to Clipboard Copied! Toggle word wrap Toggle overflow - For load balancing between the nodes of the cluster, you can add two or more IP addresses that can be used to access the Samba shares exported by this cluster to the
/etc/ctdb/public_addressesfile. These are the IP addresses that you should configure in DNS for the name of the Samba server and are the addresses that SMB clients will connect to. Configure the name of the Samba server as one DNS type A record with multiple IP addresses and let round-robin DNS distribute the clients across the nodes of the cluster.For this example, the DNS entrylinuxserver.example.comhas been defined with both the addresses listed under the/etc/ctdb/public_addressesfile. With this in place, DNS will distribute the Samba clients across the cluster nodes in a round-robin fashion. Please note that when implementing this scenario, the DNS entries should match your needs.Add the IP addresses that can be used to access the Samba shares exported by this cluster to the/etc/ctdb/public_addressesfile.cat << END > /etc/ctdb/public_addresses 192.168.1.201/24 eth0 192.168.1.202/24 eth0 END
# cat << END > /etc/ctdb/public_addresses 192.168.1.201/24 eth0 192.168.1.202/24 eth0 ENDCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a Samba group, then add a local user for the public test share directory, setting the previously created group as the primary group.
groupadd smbguest adduser smbguest -g smbguest
# groupadd smbguest # adduser smbguest -g smbguestCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Make sure that the SELinux context are correct in the CTDB-related directories.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- On one node of the cluster, perform the following steps:
- Set up the directories for the CTDB lock file and public share.
mkdir -p /mnt/gfs2share/ctdb/ mkdir -p /mnt/gfs2share/public/
[root@z1 ~]# mkdir -p /mnt/gfs2share/ctdb/ [root@z1 ~]# mkdir -p /mnt/gfs2share/public/Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Update the SELinux contexts on the GFS2 share.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow