4.4. Configuring the Samba Cluster Resources
This section provides the procedure for configuring the Samba cluster resources for this use case.
The following procedure creates a snapshot of the cluster's
cib
file named samba.cib
and adds the resources to that test file rather then configuring them directly on the running cluster. After the resources and constraints are configured, the procedure pushes the contents of samba.cib
to the running cluster configuration file.
On one node of the cluster, run the following procedure.
- Create a snapshot of the
cib
file, which is the cluster configuration file.[root@z1 ~]#
pcs cluster cib samba.cib
- Create the CTDB resource to be used by Samba. Create this resource as a cloned resource so that it will run on both cluster nodes.
[root@z1 ~]#
pcs -f samba.cib resource create ctdb ocf:heartbeat:CTDB
\ctdb_recovery_lock="/mnt/gfs2share/ctdb/ctdb.lock"
\ctdb_dbdir=/var/ctdb ctdb_socket=/tmp/ctdb.socket
\ctdb_logfile=/var/log/ctdb.log
\op monitor interval=10 timeout=30 op start timeout=90
\op stop timeout=100 --clone
- Create the cloned Samba server.
[root@z1 ~]#
pcs -f samba.cib resource create samba systemd:smb --clone
- Create the colocation and order constraints for the cluster resources. The startup order is Filesystem resource, CTDB resource, then Samba resource.
[root@z1 ~]#
pcs -f samba.cib constraint order fs-clone then ctdb-clone
Adding fs-clone ctdb-clone (kind: Mandatory) (Options: first-action=start then-action=start) [root@z1 ~]#pcs -f samba.cib constraint order ctdb-clone then samba-clone
Adding ctdb-clone samba-clone (kind: Mandatory) (Options: first-action=start then-action=start) [root@z1 ~]#pcs -f samba.cib constraint colocation add ctdb-clone with fs-clone
[root@z1 ~]#pcs -f samba.cib constraint colocation add samba-clone with ctdb-clone
- Push the content of the
cib
snapshot to the cluster.[root@z1 ~]#
pcs cluster cib-push samba.cib
CIB updated - Check the status of the cluster to verify that the resource is running.Note that in Red Hat Enterprise Linux 7.4 it can take a couple of minutes for CTDB to start Samba, export the shares, and stabilize. If you check the cluster status before this process has completed, you may see a message that the CTDB status call failed. Once this process has completed, you can clear this message from the display by running the
pcs resource cleanup ctdb-clone
command.[root@z1 ~]#
pcs status
Cluster name: my_cluster Stack: corosync Current DC: z1.example.com (version 1.1.16-12.el7_4.2-94ff4df) - partition with quorum Last updated: Thu Oct 19 18:17:07 2017 Last change: Thu Oct 19 18:16:50 2017 by hacluster via crmd on z1.example.com 2 nodes configured 11 resources configured Online: [ z1.example.com z2.example.com ] Full list of resources: myapc (stonith:fence_apc_snmp): Started z1.example.com Clone Set: dlm-clone [dlm] Started: [ z1.example.com z2.example.com ] Clone Set: clvmd-clone [clvmd] Started: [ z1.example.com z2.example.com ] Clone Set: fs-clone [fs] Started: [ z1.example.com z2.example.com ] Clone Set: ctdb-clone [ctdb] Started: [ z1.example.com z2.example.com ] Clone Set: samba-clone [samba] Started: [ z1.example.com z2.example.com ]Note
If you find that the resources you configured are not running, you can run thepcs resource debug-start resource
command to test the resource configuration. This starts the service outside of the cluster’s control and knowledge. If the configured resources are running again, runpcs resource cleanup resource
to make the cluster aware of the updates. For information on thepcs resource debug-start
command, see the Enabling, Disabling, and Banning Cluster Resources section in the High Availability Add-On Reference manual.