5.4 Cluster Resource Configuration

After the shared storage is properly configured, you must create and configure a Samba cluster resource in Novell Cluster Services. This includes configuring Samba load and unload scripts; setting Samba start, failover, and failback modes; and assigning the Samba resource to specific servers in your cluster.

5.4.1 Creating a Samba Cluster Resource

Novell Cluster Services includes a Samba resource template, which greatly simplifies the process for creating a Samba cluster resource. The Samba resource template configures the Samba resource by automatically creating Samba load and unload scripts, setting failover and failback modes, and assigning Samba as a resource to all nodes in the cluster.

To create a Samba cluster resource:

  1. Ensure the shared disk (file system) you mounted in Section 5.3.4, Creating Mount Points is unmounted.

    If you used the directory names specified in the example, you can enter the following command to unmount the shared disk:

    umount /mnt/samba

  2. Open your browser and enter the URL for iManager.

    The URL is http://server_ip_address/iManager.html. Replace server_ip_address with the IP address or DNS name of a server in the cluster or with the IP address for Apache-based services.

  3. Enter the username and password for admin or an admin-equivalent user, along with the name of the eDirectory tree or IP address of a replica server in the tree.

  4. In the left column, select Clusters > Cluster Options.

  5. In the Cluster field, specify the cluster name, or browse and select it.

    iManager displays links that you can use to configure and manage your cluster.

  6. Click New.

  7. Specify Resource as the resource type you want to create, then click Next.

  8. Specify a name for the Samba resource.

    This is the name that identifies the resource for the cluster-enabled file system.

  9. Type the Samba template name in the Inherit From Template field, or browse and select it from the list.

  10. Select Define Additional Properties, then click Next.

  11. Continue with Section 5.4.2, Configuring Samba Load, Unload, and Monitor Scripts.

5.4.2 Configuring Samba Load, Unload, and Monitor Scripts

Load Script Configuration

The Samba load script page should already be displayed. The load script contains commands to start the Samba resource, including mounting the shared file system on a server in the cluster. It is called when you migrate the service or when the primary server fails. You must customize some of the commands in the script for your specific Samba configuration.

The initial load script appears similar to the following example:

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs
# define the IP address
RESOURCE_IP=a.b.c.d
# define the file system type
MOUNT_FS=reiserfs
# define the container name
container_name=name
# define the device
MOUNT_DEV=/dev/evms/$container_name/name
# define the mount point
MOUNT_POINT=/mnt/samba
# define the name of the samba config file
CONFIG_FILE=SambaResource-smb.conf
# activate the container
exit_on_error activate_evms_container $container_name $MOUNT_DEV $NCS_TIMEOUT
# mount the file system
exit_on_error mount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
# add the IP address
exit_on_error add_secondary_ipaddress $RESOURCE_IP
# start Samba
exit_on_error /usr/sbin/nmbd --log-basename=$MOUNT_POINT/log ‑‑configfile=$MOUNT_POINT/$CONFIG_FILE
exit_on_error /usr/sbin/smbd --log-basename=$MOUNT_POINT/log ‑‑configfile=$MOUNT_POINT/$CONFIG_FILE
# return status
exit 0

To customize the Samba load script for your configuration:

  1. Edit the following lines for your specific IP address, file system type, container name, device, and mount point:

    RESOURCE_IP=a.b.c.d
    
    MOUNT_FS=reiserfs
    
    container_name=name
    
    MOUNT_DEV=/dev/evms/$container_name/name
    
    MOUNT_POINT=/mnt/samba
    

    Replace a.b.c.d with the IP address for the Samba cluster resource, such as 10.10.10.44. The IP address for the Samba cluster resource allows clients to reconnect to that address regardless of which server is hosting it.

    If you installed a POSIX file system other than ReiserFS (such as Ext3), specify the file system for the MOUNT_FS variable.

    For the container_name variable, replace name with the name (such as csm44) you assigned to the CSM container in Step 1 when you prepared the shared storage with EVMS.

    For MOUNT_DEV, replace name with the name of the volume you created within the CSM container.

    For MOUNT_POINT, replace /mnt/samba with the mount point (such as smbvol44) you created on each cluster server.

    For example, the following setup:

    # define the IP address
    RESOURCE_IP=10.10.10.44
    # define the file system type
    MOUNT_FS=ext3
    # define the container name
    container_name=csm44
    # define the device
    MOUNT_DEV=/dev/evms/$container_name/smbvol44
    # define the mount point
    MOUNT_POINT=/mnt/smbvol44
    
  2. Comment out the following line by inserting a # at the beginning of the line:

    # CONFIG_FILE=SambaResource-smb.conf
    

    Also comment out the two lines under # start Samba:

    # start Samba
    # exit_on_error /usr/sbin/nmbd --log-basename=$MOUNT_POINT/log ‑‑configfile=$MOUNT_POINT/$CONFIG_FILE
    
    # exit_on_error /usr/sbin/smbd --log-basename=$MOUNT_POINT/log ‑‑configfile=$MOUNT_POINT/$CONFIG_FILE
    

    You will uncomment these lines later, after the Samba cluster resource configuration is complete.

  3. Click Next and continue with the unload script configuration.

Unload Script Configuration

The Samba unload script page should now be displayed. The unload script contains commands to stop the Samba resource, including unmounting the shared file system on a server in the cluster. You must customize some commands for your specific Samba configuration.

The initial unload script appears similar to the following example:

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs
# define the IP address
RESOURCE_IP=a.b.c.d
# define the file system type
MOUNT_FS=reiserfs
# define the container name
container_name=name
# define the device
MOUNT_DEV=/dev/evms/$container_name/name
# define the mount point
MOUNT_POINT=/mnt/samba
# define the name of the samba config file
CONFIG_FILE=SambaResource-smb.conf
# activate the container
exit_on_error activate_evms_container $container_name $MOUNT_DEV $NCS_TIMEOUT
# request Samba stop
ignore_error killproc -p /var/run/samba/nmbd-$CONFIG_FILE.pid /usr/sbin/nmbd
ignore_error killproc -p /var/run/samba/smbd-$CONFIG_FILE.pid /usr/sbin/smbd
# del the IP address
ignore_error del_secondary_ipaddress $RESOURCE_IP
# umount the file system
exit_on_error umount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
# deactivate the container
exit_on_error deactivate_evms_container $container_name $NCS_TIMEOUT
# return status
exit 0

To customize the Samba unload script for your configuration:

  1. Edit the following lines for your specific IP address, file system type, container name, device, and mount point:

    RESOURCE_IP=a.b.c.d
    
    MOUNT_FS=reiserfs
    
    container_name=name
    
    MOUNT_DEV=/dev/evms/$container_name/name
    
    MOUNT_POINT=/mnt/samba
    

    Replace the variables with the same values you specified for the load script.

  2. Comment out the two lines under # request Samba stop.

    You will uncomment these lines later, after the Samba cluster resource configuration is complete.

  3. Click Next and continue with the monitor script configuration.

Monitor Script Configuration

The Samba monitor script page should now be displayed. The monitor script contains commands to monitor the status of the Samba resource. You must customize some commands for your specific Samba configuration.

  1. Edit the following lines for your specific IP address, file system type, container name, device, and mount point:

    RESOURCE_IP=a.b.c.d
    
    MOUNT_FS=reiserfs
    
    container_name=name
    
    MOUNT_DEV=/dev/evms/$container_name/name
    
    MOUNT_POINT=/mnt/samba
    

    Replace the variables with the same values you specified for the load and unload scripts.

  2. Click Next and continue with Section 5.4.3, Setting Samba Start, Failover, and Failback Modes.

5.4.3 Setting Samba Start, Failover, and Failback Modes

The page to set Start, Failover, and Failback modes should now be displayed.

  1. By default, the Samba resource template sets the Samba resource Start mode and Failover mode to Auto and the Failback Mode to Disable. You can change the default settings as needed.

    • If the Start mode is set to Auto, the Samba resource automatically loads on a designated server when the cluster is first brought up. If the Start mode is set to Manual, you can manually start the Samba resource on a specific server when you want, instead of having it automatically start when servers in the cluster are brought up.

    • If the Failover mode is set to Auto, the Samba resource automatically moves to the next server in the Assigned Nodes list in the event of a hardware or software failure. If the Failover mode is set to Manual, you can intervene after a failure occurs and before the Samba resource is started on another node.

    • If the Failback mode is set to Disable, the Samba resource continues running on the node it has failed to. If the Failback mode is set to Auto, the Samba resource automatically moves back to its preferred node when the preferred node is brought back online. Set the Failback mode to Manual to prevent the Samba resrouce from moving back to its preferred node when that node is brought back online, until you are ready to allow it to happen.

  2. When you have finished making the desired changes to these settings, click Next.

  3. Continue with Section 5.4.4, Editing the Samba Resource Preferred Nodes List.

5.4.4 Editing the Samba Resource Preferred Nodes List

The page to view or change the preferred nodes for the Samba resource should now be displayed. The Samba resource template automatically assigns the Samba resource to all nodes in the cluster. The order of assignment is the order the nodes appear in the resource list.

To view or edit preferred node assignments or change the server failover order:

  1. From the list of unassigned nodes, select a server you want the resource assigned to, then click the Right-arrow button to move the selected server to the Assigned Nodes list.

    Repeat this step for all servers you want assigned to the resource. You can also use the Left-arrow button to unassign servers from the resource.

  2. Click the Up-arrow and Down-arrow buttons to change the failover order of the servers assigned to the resource.

  3. Click Apply or Finish to save preferred node assignment changes.

  4. Continue with Section 5.4.5, Verifying the Samba Cluster Resource Configuration.

5.4.5 Verifying the Samba Cluster Resource Configuration

At this point, it is a good practice to verify the configuration of the Samba cluster resource.

  1. Bring the cluster online by entering the following command at a node with Novell Cluster Services installed (this will become the primary node of the cluster):

    cluster online cluster_name node_name

  2. Enter the following commands and verify that the IP address of the node and the shared file system are listed:

    ip add

    df -h

  3. Use the following command to test migration of the Samba resource to all nodes in the Preferred Nodes list:

    cluster migrate resource_name node_name

  4. To check whether the migration operation was successful, enter:

    cluster status

  5. Correct any configuration problems before continuing with Section 5.5, Samba Configuration.