Sun Cluster Data Service for Samba Guide for Solaris OS

Appendix C Deployment Example: Installing Samba in a Failover Zone

This appendix presents a complete example of how to install and configure the Samba application and data service in a failover zone. It presents a simple node cluster configuration. If you need to install the application in any other configuration, refer to the general-purpose procedures presented elsewhere in this manual.

Target Cluster Configuration

This example uses a single-node cluster with the following node and zone names:

Vigor5

The physical node, which owns the file system.

Vigor5:failover

A sparse root non-global zone named failover.

Software Configuration

This deployment example uses the following software products and versions:

This example assumes that you have already installed and established your cluster. It illustrates installation and configuration of the data service application only.

Assumptions

The instructions in this example were developed with the following assumptions:

Installing and Configuring Samba in a Failover Zone


Note –

This deployment example is designed for a single-node cluster. It is provided simply as a concise guide to help you if you need to refer to an installation and configuration of Samba.

This deployment example is not meant to be a precise guide as there are several alternate ways to install and configure Samba.

If you need to install Samba in any other configuration, refer to the general purpose procedures elsewhere in this manual.


The instructions with this deployment example assumes that you are using the Samba software packaged with Solaris 10 and will configure Samba on a ZFS highly available local file system .

The failover zonepath cannot use a ZFS highly available local file system, instead the zonepath will use a SVM highly available local system.

The cluster resource group is simply brought online and is not failed over to another node as this deployment example is on a single node cluster.

The tasks you must perform to install and configure Samba in the global and non-global zones are as follows:

ProcedureExample: Prepare the Cluster for Samba

  1. Install and configure the cluster as instructed in Sun Cluster Software Installation Guide for Solaris OS.

    Install the following cluster software components on node Vigor5.

    • Sun Cluster core software

    • Sun Cluster data service for Samba

  2. Add the logical host name to /etc/hosts and /etc/inet/ipnodes on the failover zone


    Vigor5# zlogin failover grep SMB1 /etc/hosts /etc/inet/ipnodes
    /etc/hosts:192.168.1.132	SMB1#20
    /etc/inet/ipnodes:192.168.1.132	SMB1#20
  3. Install and configure a Zettabyte File System


    Note –

    The following zpool definition represents a very basic configuration for deployment on a single-node cluster.

    You should not consider this example for use within a productive deployment, instead it is a very basic configuration for testing or development purposes only.


    1. Create a ZFS pool.


      Vigor5# zpool create -m /local HAZpool c1t1d0
      
    2. Create a ZFS


      Vigor5# zfs create HAZpool/samba
      
  4. Install and Configure a Solaris Volume Manager File System


    Note –

    The following metaset definitions represent a very basic configuration for deployment on a single-node cluster.

    You should not consider this example for use within a productive deployment, instead it is a very basic configuration for testing or development purposes only.


    1. Create a SVM Disk Set.


      Vigor5# metaset -s dg_d1 -a -h Vigor5
      
    2. Add a Disk to the SVM Disk Set


      Vigor5# metaset -s dg_d1 -a /dev/did/rdsk/d4
      
    3. Add the Disk Information to the metainit utility input file


      Vigor5# cat >> /etc/lvm/md.tab <<-EOF
      dg_d1/d100      -m      dg_d1/d110
      dg_d1/d110      1 1     /dev/did/rdsk/d4s0
      EOF
      
    4. Configure the metadevices


      Vigor5# metainit -s dg_d1 -a
      
    5. Create a Mount Point for the SVM Highly Available Local File System


      Vigor5# mkdir /zones
      
    6. Add the SVM highly available local file system to /etc/vfstab


      Vigor5# cat >> /etc/vfstab <<-EOF
      /dev/md/dg_d1/dsk/d100 /dev/md/dg_d1/rdsk/d100 /zones ufs 3 no logging
      EOF
      
    7. Create the File System


      Vigor5# newfs /dev/md/dg_d1/rdsk/d100
      
    8. Mount the File System


      Vigor5# mount /zones
      

ProcedureExample: Configure the Failover Zone

In this task you will install two Solaris Containers on node Vigor5.

  1. Create a non-global zone to be used as the failover zone

    If a whole root non-global zone is required you must specify create -b.


    Vigor5# cat > /tmp/failover <<-EOF
    create
    set zonepath=/zones/failover
    set autoboot=false
    add inherit-pkg-dir
    set dir=/opt/SUNWscsmb
    end
    EOF
    
  2. Configure the non-global failover zone, using the file you created.


    Vigor5# zonecfg -z failover -f /tmp/failover
    
  3. Install the zones.


    Vigor5# zoneadm -z failover install
    
  4. Boot the zone.


    Vigor5# zoneadm -z failover boot
    
  5. Log in to the zone and complete the zone system identification.

    Open another window and issue the following command.


    Vigor5# zlogin -C failover
    
  6. Close the terminal window and disconnect from the zone console.

    After you have completed the zone system identification, disconnect from the window you previously opened.


    Vigo5# ~.
    
  7. Create local mount points for the HA-ZFS file system with in the zones.


    Vigor5# zlogin failover mkdir /local
    
  8. Create the Samba Fault Monitor Userid in the zones.


    Vigor5# zlogin failover groupadd -g 1000 samba
    Vigor5# zlogin failover useradd -u 1000 -g 1000 -s /bin/false homer
    
  9. Halt the zone.


    Vigor5# zlogin failover halt
    

ProcedureExample: Configure Cluster Resources for Samba

  1. Register the necessary data types on the single node cluster


    Vigor5# clresourcetype register SUNW.gds SUNW.HAStoragePlus
    
  2. Create the Samba resource group.


    Vigor5# clresourcegroup create -n Vigor5 samba-rg
    
  3. Create the logical host.


    Vigor5# clreslogicalhostname create -g samba-rg -h SMB1 samba-lh
    
  4. Create the SVM HAStoragePlus resource in the samba-rg resource group.


    Vigor5# clresource create -g samba-rg -t SUNW.HAStoragePlus \
    > -p FilesystemMountPoints=/zones sambaSVM-has
    
  5. Create the ZFS HAStoragePlus resource in the samba-rg resource group.


    Vigor5# clresource create -g samba-rg -t SUNW.HAStoragePlus \
    > -p Zpools=HAZpool sambaZFS-has
    
  6. Enable the resource group.


    Vigor5# clresourcegroup online -M samba-rg
    
  7. Create the Sun Cluster HA for Solaris Container Configuration file.


    Vigor5# cat > /var/tmp/sczbt_config <<-EOF
    RS=sambaFOZ
    RG=samba-rg
    PARAMETERDIR=/zones
    SC_NETWORK=true
    SC_LH=samba-lh
    FAILOVER=true
    HAS_RS=sambaSVM-has,sambaZFS-has
    
    Zonename=failover
    Zonebootopt=
    Milestone=multi-user-server
    Mounts=/local
    EOF
    
  8. Register the Sun Cluster HA for Solaris Container data service.


    Vigor5# /opt/SUNWsczone/sczbt/util/sczbt_register -f /var/tmp/sczbt_config
    
  9. Enable the failover zone resource


    Vigor5# clresource enable sambaFOZ
    

ProcedureExample: Create the Samba smb.conf Configuration File

  1. Create the Samba Configuration Directory.


    Vigor5# mkdir -p /local/samba/smb1
    Vigor5# cd /local/samba/smb1
    Vigor5# mkdir -p lib logs private shares var/locks
    
  2. Create the Samba smb.conf Configuration File.


    Vigor5# cat > /local/samba/smb1/lib/smb.conf <<-EOF
    [global]
            workgroup = PDC
            bind interfaces only = yes
            interfaces = SMB1/255.255.255.0
            netbios name = SMB1
            security = user
            server string = Samba (%v) domain (%h)
            pid directory = /local/samba/smb1/var/locks
            log file = /local/samba/smb1/logs/log.%m
            smb passwd file = /local/samba/smb1/private/smbpasswd
            private dir = /local/samba/smb1/private
            lock dir = /local/samba/smb1/var/locks
            domain logons = yes
            domain master = yes
            preferred master = yes
    
    [scmondir]
            comment = Monitor directory for Sun Cluster
            path = /tmp
            browseable = No
    EOF
    
  3. Test the Samba smb.conf Configuration File.


    Vigor5# zlogin failover /usr/sfw/bin/testparm \
    > -s /local/samba/smb1/lib/smb.conf
    
  4. Add the Samba Fault Monitor Userid.


    Note –

    You should specify samba as the password, otherwise you will need to change the SAMBA_FMPASS variable in Step 1 in Example: Enable the Samba Software to Run in the Cluster



    Vigor5# zlogin failover /usr/sfw/bin/smbpasswd \
    > -c /local/samba/smb1/lib/smb.conf -a homer
    

ProcedureExample: Verify Samba

  1. Start Samba using the smbd program.


    Vigor5# zlogin failover /usr/sfw/sbin/smbd \
    > -s /local/samba/smb1/lib/smb.conf -D
    
  2. Connect to Samba using the smbclient program.


    Vigor5# zlogin failover /usr/sfw/bin/smbclient -N -L SMB1 \
    > -s /local/samba/smb1/lib/smb.conf
    Vigor5#
    Vigor5# zlogin failover /usr/sfw/bin/smbclient '//SMB1/scmondir' \
    > -U homer -c 'pwd;exit' -s /local/samba/smb1/lib/smb.conf
    
  3. Stop Samba.


    Vigor5# zlogin failover pkill -TERM smbd
    

ProcedureExample: Enable the Samba Software to Run in the Cluster

  1. Create the Sun Cluster HA for Samba Configuration file.


    Vigor5# cat > /var/tmp/samba_config <<-EOF
    #+++ Resource Specific Parameters +++
    RS=samba
    RG=samba-rg
    RS_LH=samba-lh
    RS_HAS=sambaZFS-has
    SERVICES="smbd,nmbd"
    
    #+++ Common Parameters +++
    BINDIR=/usr/sfw/bin
    SBINDIR=/usr/sfw/sbin
    CFGDIR=/local/samba/smb1
    LDPATH=/usr/sfw/lib
    FMUSER=homer
    
    #+++ SMBD & NMBD Specific Parameters (See Note 1) +++
    SAMBA_LOGDIR=/local/samba/smb1/logs
    SAMBA_FMPASS=samba
    SAMBA_FMDOMAIN=
    
    #+++ WINBIND Specific Parameters (See Note 2) +++
    WINBIND_DISCACHE=FALSE
    WINBIND_SINGLEMODE=FALSE
    
    #+++ Zone Specific Parameters (See Note 3) +++
    RS_ZONE=sambaFOZ
    LHOST=192.168.1.132
    PROJECT=default
    TIMEOUT=30
    EOF
    
  2. Register the Sun Cluster HA for Samba data service.


    Vigor5# /opt/SUNWscsmb/util/samba_register -f /var/tmp/samba_config
    
  3. Enable the resource.


    Vigor5# clresource enable samba
    

ProcedureExample: Verify the Sun Cluster HA for Samba resource group

    Check the status of the Samba resources.


    Vigor5# clrs status sambaFOZ
    Vigor5# clrs status samba
    Vigor5# clrg status samba-rg