Before you perform this procedure, ensure that the Sun Cluster HA for Solaris Containers data service packages are installed.
Use the configuration and registration files in the following directories to register the Sun Cluster HA for Solaris Containers resources:
/opt/SUNWsczone/sczbt/util
/opt/SUNWsczone/sczsh/util
/opt/SUNWsczone/sczsmf/util
The files define the dependencies that are required between the Sun Cluster HA for Solaris Containers components. For information about these dependencies, see Dependencies Between Sun Cluster HA for Solaris Containers Components
Registering and configuring Sun Cluster HA for Solaris Containers involves the tasks that are explained in the following sections:
Specifying Configuration Parameters for the Zone Boot Resource
Specifying Configuration Parameters for the Zone Script Resource
Specifying Configuration Parameters for the Zone SMF Resource
How to Create and Enable Resources for the Zone Boot Component
How to Create and Enable Resources for the Zone Script Component
How to Create and Enable Resources for the Zone SMF Component
Sun Cluster HA for Solaris Containers provides the script sczbt_register, which automates the process of configuring the zone boot resource. By default this script obtains configuration parameters from the sczbt_config file in the /opt/SUNWsczone/sczbt/util directory. To specify configuration parameters for the zone boot resource, copy the sczbt_config file to a different filename and amend it as described below. It is recommended to keep this file as a future reference. The register script provides option -f to specify the fully qualified filename to the copied configuration file.
Each configuration parameter in the sczbt_config file is defined as a keyword-value pair. The sczbt_config file already contains the required keywords and equals signs. For more information, see Listing of sczbt_config. When you edit the sczbt_config file, add the required value to each keyword.
The keyword-value pairs in the sczbt_config file are as follows:
RS=sczbt-rs RG=sczbt-rg PARAMETERDIR=sczbt-parameter-directory SC_NETWORK=true|false SC_LH=sczbt-lh-rs FAILOVER=true|false HAS_RS=sczbt-has-rs Zonename=zone-name Zonebrand=zone-brand-type Zonebootopt=zone-boot-options Milestone=zone-boot-milestone LXrunlevel=linux-runlevel SLrunlevel=solaris-legacy-runlevel Mounts=list-of-mountpoints
The meaning and permitted values of the keywords in the sczbt_config file are as follows:
Specifies the name that you are assigning to the zone boot resource. You must specify a value for this keyword.
Specifies the name of the resource group the zone boot resource will reside in. You must specify a value for this keyword.
Specifies the directory name that you are assigning to the parameter directory where some variables and their values will be stored. You must specify a value for this keyword.
Specifies whether the zone boot resource is network aware with a SUNW.LogicalHostName resource. You must specify a value for this keyword.
If HA for the zone's addresses is not required, then configure the zone`s addresses by using the zonecfg utility.
SC_NETWORK=false SC_LH= |
If only HA through IPMP protection is required, then configure the zone's addresses by using the zonecfg utility and then place the zone's addresses on an adapter within an IPMP group.
SC_NETWORK=false SC_LH= |
If HA through IPMP protection and protection against the failure of all physical interfaces by triggering a failover is required, choose one option from the following list:
If you require the SUNW.LogicalHostName resource type to manage one or a subset of the zone's addresses, configure a SUNW.LogicalHostName resource for those zone's addresses and not by using the zonecfg utility. Use the zonecfg utility to configure only the zones's addresses that are not to be under the control of the SUNW.LogicalHostName resource.
SC_NETWORK=true SC_LH=Name of the SUNW.LogicalHostName resource |
If you require the SUNW.LogicalHostName resource type to manage all the zone's addresses, configure a SUNW.LogicalHostName resource with a list of the zone's addresses and do not configure them by using the zonecfg utility.
SC_NETWORK=true SC_LH=Name of the SUNW.LogicalHostName resources |
Otherwise, configure the zone's addresses by using the zonecfg utility and configure a separate redundant IP address for use by a SUNW.LogicalHostName resource, which must not be configured using the zonecfg utility.
SC_NETWORK=false SC_LH=Name of the SUNW.LogicalHostName resource |
Specifies the name of the SUNW.LogicalHostName resource for the zone boot resource. Refer to Restrictions for Zone Network Addresses for a description of when to set this variable. This name must be the SUNW.LogicalHostname resource name you assigned when you created the resource in Step 4.
Specifies whether the zone's zone path is on a highly available file system.
Specifies the name of the SUNW.HAStoragePlus resource for the zone boot resource. This name must be the SUNW.HAStoragePlus resource name you assigned when you created the resource in How to Enable a Zone to Run in a Failover Configuration. You must specify a value for this keyword if FAILOVER=true is set.
Specifies the zone name. You must specify a value for this keyword.
Specifies the brand type of the zone. The options that are currently supported are native (default), lx, solaris8, or solaris9. You must specify a value for this keyword.
Specifies the zone boot option to use. Only -s is supported. Leaving this variable blank will cause the zone to boot to the multi-user-server milestone.
Specifies the milestone the zone must reach to be considered successfully booted. This option is only used for the native brand type. You must specify a value for this keyword if you set the Zonebrand option to native.
Specifies the runlevel that needs to be attained before the zone is considered booted. This option is used only for the lx brand type. You must specify a value for this keyword if you set the Zonebrand option to lx.
Specifies the legacy runlevel that needs to be attained before the zone is considered booted. This option is only used for the solaris8 and solaris9 brand types. You must specify a value for this keyword, if you set the Zonebrand option to solaris8 or solaris9.
Specifies a space separated list of directories with their mount options, which will automatically get lofs mounted from the global zone into the booted zone. The mount point used in the global zone can be different to the mount point in the booted zone. Specifying a value for this keyword is optional.
The Mounts keyword format is as follows:
Mounts="/global-zone-dir:/local-zone-dir:mount-options <next entry>" |
While mount-options can be a comma separated list of file system mount options.
The only required entry when setting this keyword is the /global-zone-dir part of the colon separated variable. The /local-zone-dir and mount-options part can be omitted.
Omitting the /local-zone-dir part will make the zone's mount point the same as the global zone directory.
Omitting the mount-options part will not provide any mount options except the default options from the mount command.
If you are omitting the /local-zone-dir or the mount-options, you must also omit the “:” as delimiter.
You must manually create any mount point directories within the booted zone that will be used within the Mounts keyword, before registering this resource within Sun Cluster.
If the file system of the source mount point in the global zone is mounted by a SUNW.HAStoragePlus resource, you must specify a strong resource dependency from the sczbt resource to this SUNW.HAStoragePlus resource.
This example shows an sczbt_config file in which configuration parameters are set as follows:
The name of the zone boot resource is zone1-rs.
The name of the resource group for the zone boot resource is zone1-rg.
The name of the parameter file directory for the zone boot resource is/global/zones/pfiles.
Indicates that the zone's address is managed by a SUNW.LogicalHostName resource and is true.
The name of the SUNW.LogicalHostName resource name for the zone boot resource is zone1-lh.
Indicates that the zone boot resource's zone path is managed by a SUNW.LogicalHostName resource and is true.
The name of the SUNW.HAStoragePlus resource name for the zone boot resource is zone1-has.
The name of the zone is zone1.
The brand type of the zone is native.
Indicates that the zone boot resource`s boot option is null.
Indicates that the zone boot resource`s milestone is multi-user-server.
Defines that /global/app/bin from the global zone gets mounted read-only within zone zone1 under mount point /app/bin.
Defines that /app/data from the global zone gets mounted read-write within zone zone1 under mount point /app/data.
Defines that /logs from the global zone gets mounted with default mount options within zone zone1 under mount point /logs.
RS=zone1-rs RG=zone1-rg PARAMETERDIR=/global/zones/pfiles SC_NETWORK=true SC_LH=zone1-lh FAILOVER=true HAS_RS=zone1-has Zonename=zone1 Zonebrand=native Zonebootopt= Milestone=multi-user-server Mounts="/global/app/bin:/app/bin:ro /app/data:rw /logs"
The zone script resource provides the ability to run commands or scripts to start, stop and probe an application within a zone. The zone script resource depends on the zone boot resource. The command or script names are passed to the zone script resource when the resource is registered and must meet with the following requirements.
The command or script must contain the fully qualified path within the zone.
The command or script must be executable by root.
The command or script must return one of the following return codes.
0 |
Successful completion |
>0 |
An error has occurred |
201 |
(Probe only) — An error has occurred that requires an immediate failover of the resource group |
>0 & !=201 |
(Probe only) — An error has occurred that requires a resource restart |
For an immediate failover of the zone script resource, you must configure the resource properties Failover_mode and Failover_enabled to meet the required behavior. Refer to the r_properties(5) man page when setting the Failover_mode property and SUNW.gds(5) man page when setting the Failover_enabled property.
This example shows a simple script to test that the Apache2 service is running, beyond the process tree existing. The script /var/tmp/probe-apache2 must exist and being executable within the zone.
# cat /var/tmp/probe-apache2 #!/usr/bin/ksh if echo "GET; exit" | mconnect -p 80 > /dev/null 2>&1 then exit 0 else exit 100 fi # chmod 755 /var/tmp/probe-apache2 |
Sun Cluster HA for Solaris Containers provides the script sczsh_register, which automates the process of configuring zone script resource. By default this script obtains configuration parameters from the sczsh_config file in the /opt/SUNWsczone/sczsh/util directory. To specify configuration parameters for the zone script resource, copy the sczsh_config file to a different filename and amend it as described below. It is recommended to keep this file as a future reference. The register script provides option -f to specify the fully qualified filename to the copied configuration file.
Each configuration parameter in the sczsh_config file is defined as a keyword-value pair. The sczsh_config file already contains the required keywords and equals signs. For more information, see Listing of sczsh_config. When you edit the sczsh_config file, add the required value to each keyword.
The keyword-value pairs in the sczsh_config file are as follows:
RS=sczsh-rs RG=sczbt-rg SCZBT_RS=sczbt-rs PARAMETERDIR=sczsh-parameter-directory Zonename=sczbt-zone-name ServiceStartCommand=sczsh-start-command ServiceStopCommand=sczsh-stop-command ServiceProbeCommand=sczsh-probe-command
The meaning and permitted values of the keywords in the sczsh_config file are as follows:
Specifies the name that you are assigning to the zone script resource. You must specify a value for this keyword.
Specifies the name of the resource group the zone boot resource resides in. You must specify a value for this keyword.
Specifies the name of the zone boot resource. You must specify a value for this keyword.
Specifies the directory name that you are assigning to the parameter directory where the following variables and their values will be stored. You must specify a value for this keyword.
Specifies the zone name. You must specify a value for this keyword.
Specifies the zone start command or script to run. You must specify a value for this keyword.
Specifies the zone stop command or script to run. You must specify a value for this keyword
Specifies the zone probe command or script to run. You must specify a value for this keyword
In this example the zone script resource uses the Apache2 scripts that are available in Solaris 10. Before this example can be used the Apache2 configuration file http.conf needs to be configured. For the purpose of this example, the delivered http.conf-example can be used. Copy the file as follows:
# zlogin zone1 # cd /etc/apache2 # cp http.conf-example httpd.conf # exit |
This example shows an sczsh_config file in which configuration parameters are set as follows:
The name of the zone script resource is zone1-script-rs.
The name of the resource group for the zone script resource is zone1-rg.
The name of the zone boot resource is zone1-rs.
The name of the parameter file directory for the zone script resource is /global/zones/pfiles.
The name of the zone is zone1.
The name of the zone script resource start command and it`s parameter is "/lib/svc/method/http-apache2 start".
The name of the zone script resource stop command and it`s parameter is "/lib/svc/method/http-apache2 stop".
The name of the zone script resource probe command is "/var/tmp/probe-apache2". This script is shown in Example 2 and must exist in zone1.
RS="zone1-script-rs" RG="zone1-rg" SCZBT_RS="zone1-rs" PARAMETERDIR="/global/zones/pfiles" Zonename="zone1" ServiceStartCommand="/lib/svc/method/http-apache2 start" ServiceStopCommand="/lib/svc/method/http-apache2 stop" ServiceProbeCommand="/var/tmp/probe-apache2"
The zone SMF resource provides the ability to enable, disable, and probe an SMF service within a zone that is of brand type native. The zone SMF resource depends on the zone boot resource. Probing the SMF service is performed by running a command or script against the SMF service. The SMF service and probe command or script names are passed to the zone SMF resource when the resource is registered. The probe command or script must meet the following requirements.
The probe command or script must contain the fully qualified path within the zone.
The probe command or script must be executable by root.
The probe command or script must return one of the following return codes.
0 |
Successful completion |
100 |
An error occurred that requires a resource restart |
201 |
An error has occurred that requires an immediate failover of the resource group |
For an immediate failover of the zone SMF resource, you must configure the resource properties Failover_mode and Failover_enabled to meet the required behavior. Refer to the r_properties(5) man page when setting the Failover_mode property ad SUNW.gds(5) man page when setting the Failover_enabled property.
This example shows a simple script to test that the SMF Apache2 service is running, beyond the process tree existing. The script /var/tmp/probe-apache2 must exist and being executable within the zone.
# cat /var/tmp/probe-apache2 #!/usr/bin/ksh if echo "GET; exit" | mconnect -p 80 > /dev/null 2>&1 then exit 0 else exit 100 fi # chmod 755 /var/tmp/probe-apache2 |
Sun Cluster HA for Solaris Containers provides the script sczsmf_register, which automates the process of configuring the zone SMF resource. By default this script obtains configuration parameters from the sczsmf_config file in the /opt/SUNWsczone/sczsmf/util directory. To specify configuration parameters for the zone SMF resource, copy the sczsmf_config file to a different filename and amend it as described below. It is recommended to keep this file as a future reference. The register script provides option -f to specify the fully qualified filename to the copied configuration file.
Each configuration parameter in the sczmf_config file is defined as a keyword-value pair. The sczsmf_config file already contains the required keywords and equals signs. For more information, see Listing of sczsmf_config. When you edit the sczsmf_config file, add the required value to each keyword.
The keyword-value pairs in the sczsmf_config file are as follows:
RS=sczsmf-rs RG=sczbt-rg SCZBT_RS=sczbt-rs ZONE=sczbt-zone-name SERVICE=smf-service RECURSIVE=true|false STATE=true|false SERVICE_PROBE=sczsmf-service-probe
The meaning and permitted values of the keywords in the sczsmf_config file are as follows:
Specifies the name that you are assigning to the zone SMF resource. This must be defined.
Specifies the name of the resource group the zone boot resource resides in. This must be defined.
Specifies the name of the zone boot resource. You must specify a value for this keyword.
Specifies the zone name. This must be defined.
Specifies the SMF service to enable/disable. This must be defined.
Specifies true to enable the service recursively or false to just enable the service and no dependents. This must be defined.
Specifies true to wait until the service state is reached or false to not wait until the service state is reached. This must be defined.
Specify the script to check the SMF service. Specifying a value for this keyword is optional.
In this example the zone SMF resource uses the Apache2 SMF service that is available in Solaris 10. Before this example can be used the Apache2 configuration file http.conf needs to be configured. For the purpose of this example, the delivered http.conf-example can be used. Copy the file as follows:
# zlogin zone1 # cd /etc/apache2 # cp http.conf-example http.conf # exit |
This example shows an sczsmf_config file in which configuration parameters are set as follows:
The name of the zone SMF resource is zone1-smf-rs.
The name of the resource group for the zone SMF resource is zone1-rg.
The name of the zone boot resource is zone1-rs.
The name of the zone name is zone1.
The name of the zone SMF service is apache2.
Indicates that the zone SMF service Recursive option is true.
Indicates that the zone SMF service State option is true.
Indicates that the zone SMF service probe name is /var/tmp/probe-apache2. This script is shown in Example 4 and must exist in zone1.
RS=zone1-smf-rs RG=zone1-rg SCZBT_RS=zone1-rs ZONE=zone1 SERVICE=apache2 RECURSIVE=true STATE=true SERVICE_PROBE=/var/tmp/probe-apache2
Ensure you have edited the sczbt_config file or a copy of it to specify configuration parameters for the Sun Cluster HA for Solaris Containers zone boot component. For more information, see Specifying Configuration Parameters for the Zone Boot Resource.
Become superuser on one of the nodes in the cluster that will host the zone.
Register the SUNW.gds resource type.
# clresourcetype register SUNW.gds |
Go to the directory that contains the script for creating the Sun Cluster HA for Solaris Containers boot resource.
# cd /opt/SUNWsczone/sczbt/util |
Run the script that creates the zone boot resource.
# ./sczbt_register -f /mypath/sczbt_config |
Bring online the zone boot resource.
# clresource enable sczbt-rs |
Ensure you have edited the sczsh_config file or a copy of it to specify configuration parameters for the Sun Cluster HA for Solaris Containers zone script component. For more information, see Specifying Configuration Parameters for the Zone Script Resource.
Go to the directory that contains the script for creating the Sun Cluster HA for Solaris Containers script resource.
# cd /opt/SUNWsczone/sczsh/util |
Run the script that creates the zone script resource.
# ./sczsh_register -f /mypath/sczsh_config |
Bring online the zone script resource.
# clresource enable sczsh-rs |
Ensure you have edited the sczsmf_config file or a copy of it to specify configuration parameters for the Sun Cluster HA for Solaris Containers zone SMF component. For more information, see Specifying Configuration Parameters for the Zone SMF Resource.
Go to the directory that contains the script for creating the Sun Cluster HA for Solaris Containers SMF resource.
# cd /opt/SUNWsczone/sczsmf/util |
Run the script that creates the zone SMF resource.
# ./sczsmf_register -f /mypath/sczsmf_config |
Bring online the zone SMF resource.
# clresource enable sczsmf-rs |