Introduction
The previous article covered the configuration of two resource groups, each containing a failover zpool for use as the zonepath to a highly-available zone, and a failover IP address to be assigned to each zone. The two zones were also configured and installed, and we verified that they could be booted on either node of the cluster, provided that the storage had been failed over appropriately and was available on the node where the zone was being booted.
This final part in the series will cover the incorporation of the zone boot/shutdown/failover into the cluster framework, as well as the configuration of two iPlanet resources to illustrate how Solaris Cluster can manage SMF services deployed within a highly-available Solaris zone.
Highly-Available Zones
First, install the ha-zones data service, if you haven’t done so already. I installed the full cluster package suite, so already have all data services at my disposal:
|
1 |
# pkg install ha-cluster/data-service/ha-zones |
Register the SUNW.gds resource type:
|
1 |
# clresourcetype register SUNW.gds |
This is the Generic Data Service that is utilised by SUNWsczone (HA for Solaris Containers) for deploying highly-available zones. SUNWsczone supplies three highly-available mechanisms for zone deployment - sczbt (zone boot - used to start/stop/failover zones), sczsh (zone script resource - used for deploying highly-available services within zones, with start/stop scripts to control them) and sczsmf (zone SMF resource, used for deploying highly-available services within zones, with SMF services to control them). We’ll be using both sczbt and sczsmf.
To register our highly-available failover zones as clustered resources, a template configuration file and registration script are provided, both of which are located under /opt/SUNWsczone/sczbt/util. To start configuring the resource, take a copy of sczbt_config and give it an appropriate name - one per zone. Whilst these files are not required after the resource is registered, it’s worth keeping them for future reference. To that end, I create them on both nodes.
|
1 2 3 |
# cd /opt/SUNWsczone/sczbt/util # cp -p sczbt_config sczbt_config.ha-zone-1-res # cp -p sczbt_config sczbt_config.ha-zone-2-res |
Edit each file - the template is very well documented within its comments. For ha-zone-1:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# vi sczbt_config.ha-zone-1-res # grep '^[^#]' sczbt_config.ha-zone-1-res RS=ha-zone-1-res RG=ha-zone-1-rg PARAMETERDIR=/ha-zone-1-pool/ha-zone-1/params SC_NETWORK=true SC_LH=ha-zone-1-lh-res FAILOVER=true HAS_RS=ha-zone-1-hasp Zonename="ha-zone-1" Zonebrand="solaris" Zonebootopt="" Milestone="svc:/milestone/multi-user-server" LXrunlevel="3" SLrunlevel="3" Mounts="" |
and for ha-zone-2:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# vi sczbt_config.ha-zone-2-res # grep '^[^#]' sczbt_config.ha-zone-2-res RS=ha-zone-2-res RG=ha-zone-2-rg PARAMETERDIR=/ha-zone-2-pool/ha-zone-2/params SC_NETWORK=true SC_LH=ha-zone-2-lh-res FAILOVER=true HAS_RS=ha-zone-2-hasp Zonename="ha-zone-2" Zonebrand="solaris" Zonebootopt="" Milestone="svc:/milestone/multi-user-server" LXrunlevel="3" SLrunlevel="3" Mounts="" |
I’ll summarise the directives here below:
RS- The name of the failover zone resource to be createdRG- The name of the resource group containingRGPARAMETERDIR- Path of the parameter directory used to contain the zone boot resource parameters (this will be created shortly)SC_NETWORK-trueifSUNW.LogicalHostnameresources are used,falseif the zone has its interface(s) configured via traditionalzonecfgmethodsZonename- The name of the zoneZonebrand- Brand of the zone. Ours are straight Solaris 11, which is brandsolarisMilestone- SMF Milestone which needs to be online before the zone is considered booted - we specifysvc:/milestone/multi-user-serverZonebootopt- Any zone boot options requiredLXrunlevel- Only used with thelxZonebrand (i.e. Linux branded zones) - runlevel which needs to get reached before zone is considered bootedSLrunlevel- Solaris legacy runlevel which needs to get reached before the zone is considered booted (only used withsolaris8andsolaris9Zonebrands)Mounts- A list of directories and their mount options to be loopback mounted from the global zone.
Take a look at the original sczbt_config for more details.
Next, create PARAMETERDIR as defined above. This should be on shared storage - I create them at <zonepath>/params - so do this on the node currently mastering the resources (clusternode2 in my case):
|
1 2 |
# mkdir /ha-zone-1-pool/ha-zone-1/params # mkdir /ha-zone-2-pool/ha-zone-2/params |
Now, the zone boot resources can be registered. Still within the /opt/SUNWsczone/sczbt/util directory, run the sczbt_register script against each configuration file:
|
1 2 3 4 5 6 7 8 |
# ./sczbt_register -f ./sczbt_config.ha-zone-1-res sourcing ./sczbt_config.ha-zone-1-res Registration of resource ha-zone-1-res succeeded. Validation of resource ha-zone-1-res succeeded. # ./sczbt_register -f ./sczbt_config.ha-zone-2-res sourcing ./sczbt_config.ha-zone-2-res Registration of resource ha-zone-2-res succeeded. Validation of resource ha-zone-2-res succeeded |
You can now enable the resources:
|
1 2 |
# clresource enable ha-zone-1-res # clresource enable ha-zone-2-res |
On clusternode2, you should see that both zones are now in a running state:
|
1 2 3 4 5 |
# zoneadm list -cv ID NAME STATUS PATH BRAND IP 0 global running / solaris shared 5 ha-zone-1 running /ha-zone-1-pool/ha-zone-1 solaris shared 6 ha-zone-2 running /ha-zone-2-pool/ha-zone-2 solaris shared |
Try ssh-ing into the zones via their respective logical hostnames:
|
1 2 |
# ssh toki@ha-zone-1 # ssh toki@ha-zone-2 |
And verify the status of the resources with clresource status:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# clrs status === Cluster Resources === Resource Name Node Name State Status Message ------------- --------- ----- -------------- ha-zone-1-res clusternode2 Online Online - Service is online. clusternode1 Offline Offline ha-zone-1-lh-res clusternode2 Online Online - LogicalHostname online. clusternode1 Offline Offline - LogicalHostname offline. ha-zone-1-hasp clusternode2 Online Online clusternode1 Offline Offline ha-zone-2-res clusternode2 Online Online clusternode1 Offline Offline ha-zone-2-lh-res clusternode2 Online Online - LogicalHostname online. clusternode1 Offline Offline - LogicalHostname offline. ha-zone-2-hasp clusternode2 Online Online clusternode1 Offline Offline |
Cool - everything is online! If you take a look at the sczbt_register script, you will see that the appropriate resource dependencies on the HAStoragePlus and LogicalHostname resources are created. This can be verified with a command such as:
|
1 2 3 4 5 |
# clresource show -v ha-zone-1-res | grep Resource_dependencies Resource_dependencies: ha-zone-1-lh-res Resource_dependencies_weak: <NULL> Resource_dependencies_restart: <NULL> Resource_dependencies_offline_restart: ha-zone-1-hasp |
As the zones are running on independent zpools, we can fail one of the resource groups over to clusternode1, and confirm correct operation:
|
1 2 3 4 5 6 7 8 9 10 11 12 |
# clrg switch -n clusternode1 ha-zone-1-rg # clrg status === Cluster Resource Groups === Group Name Node Name Suspended Status ---------- --------- --------- ------ ha-zone-1-rg clusternode2 No Offline clusternode1 No Online ha-zone-2-rg clusternode2 No Online clusternode1 No Offline |
Done - we now have two highly-available Solaris zones. But zones are no good without a service to host. Let’s configure iPlanet to run as an SMF service under ha-zone-1, and then configure the cluster to manage it.
Zone SMF Configuration and Clustering
In this section, I’ll install Oracle iPlanet 7.0.15 into ha-zone-1, and configure it be managed by the cluster. I’ll write some very basic probe scripts to provide health monitoring (these scripts can be as simple or as complex as your monitoring requirements dictate).
First, unzip the iPlanet installation media to a suitable location:
|
1 2 3 4 |
# cd /var/tmp # unzip 145844-08.zip # cd 145844-08 # unzip Oracle-iPlanet-Web-Server-7.0.15-solaris-x86.zip |
Launch ./setup, and run through the installation wizard. I accepted defaults for everything for the purposes of this demostration and installed to /opt/oracle/webserver7 - this created an administration server and a web server instance. I did, however, deviate from defaults to run 64-bit runtimes, and to create SMF services for the server instances - we need those for our clustered sczsmf resources. I could have chosen “no” to SMF service creation, and instead use sczsh resources (specify start/stop scripts instead of SMF services), but it’s cleaner to use SMF services if they are available. Here is my session:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# ./setup Welcome to the Oracle iPlanet Web Server 7.0.15 installation wizard. Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. You will be asked to specify preferences that determine how Oracle iPlanet Web Server 7.0.15 is installed and configured. The installation program pauses as questions are presented so you can read the information and make your choice. When you are ready to continue, press Enter (Return on some keyboards). <Press ENTER to Continue> Some questions require that you provide more detailed information. Some questions also display default values in brackets []. For example, yes is the default answer to the following question: Are you sure? [yes] To accept the default, press Enter. To provide a different answer, type the information at the command prompt and then press Enter. <Press ENTER to Continue> Oracle iPlanet Web Server components will be installed in the directory listed below, referred to as the installation directory. To use the specified directory, press Enter. To use a different directory, enter the full path of the directory and press Enter. Oracle iPlanet Web Server Installation Directory [/opt/oracle/webserver7] {"<" goes back, "!" exits}: Specified directory /opt/oracle/webserver7 does not exist Create Directory? [Yes/No] [yes] {"<" goes back, "!" exits} Select the Type of Installation 1. Express 2. Custom 3. Exit What would you like to do [1] {"<" goes back, "!" exits}? 2 Component Selection 1. Server Core 2. Server Core 64-bit Binaries 3. Administration Command Line Interface 4. Sample Applications Enter the comma-separated list [ 1,2,3,] {"<" goes back, "!" exits}: Based on component dependencies for your selection... The following components will be installed: Server Core Server Core 64-bit Binaries Administration Command Line Interface Java Configuration Oracle iPlanet Web Server requires Java SE Development Kit (JDK). Provide the path to a JDK 1.6.0_24 or greater. 1. Install Java SE Development Kit (JDK) 1.6.0_24 2. Reuse existing Java SE Development Kit (JDK) 1.6.0_24 or greater 3. Exit What would you like to do [1] {"<" goes back, "!" exits}? Administration Options 1. Create an Administration Server and a Web Server Instance 2. Create an Administration Node Enter your option [1] {"<" goes back, "!" exits} Create SMF services for server instances [yes/no] [no] {"<" goes back, "!" exits}: yes This panel collects some required information for creating an administration server. Host Name [ha-zone-1] {"<" goes back, "!" exits} SSL Port [8989] {"<" goes back, "!" exits} Create a non-SSL Port [yes/no] [no] {"<" goes back, "!" exits}: Runtime User ID [root] {"<" goes back, "!" exits} Administrator User Name [admin] {"<" goes back, "!" exits} Administrator Password: Retype Password: A web server instance is created as part of the installation. This panel lets you customize some of the server settings. Server Name [ha-zone-1] {"<" goes back, "!" exits} HTTP Port [80] {"<" goes back, "!" exits} Runtime User ID [webservd] {"<" goes back, "!" exits} Document Root Directory [/opt/oracle/webserver7/https-ha-zone-1/docs] {"<" Enable 64-bit runtime [yes/no] [no] {"<" goes back, "!" exits}: yes Product : Oracle iPlanet Web Server Location : /opt/oracle/webserver7 Disk Space : 298.50 MB ------------------------------------------------------ Server Core Server Core 64-bit Binaries Administration Command Line Interface Start Administration Server [yes/no] [yes] {"<" goes back, "!" exits}: Ready to Install 1. Install Now 2. Start Over 3. Exit Installation What would you like to do [1] {"<" goes back, "!" exits}? Installing Oracle iPlanet Web Server |-1%--------------25%-----------------50%-----------------75%--------------100%| Installation Successful. Refer to the installation log file at: /opt/oracle/webserver7/setup/install.log for more details. Next Steps: - You can access the Administration Console by accessing the following URL: https://ha-zone-1:8989 |
Once the installation was complete, I logged in via wadm and confirmed that the instance had been created (and that the admin server was running):
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# cd /opt/oracle/webserver7/bin # ./wadm --user=admin --host=localhost --port=8989 Please enter admin-user-password> Connected to localhost:8989 Oracle iPlanet Web Server 7.0.15 B04/20/2012 01:17 wadm> list-configs ha-zone-1 wadm> list-instances --node=localhost ha-zone-1 wadm> list-http-listeners --config=ha-zone-1 http-listener-1 wadm> get-http-listener-prop --config=ha-zone-1 --http-listener=http-listener-1 port=80 enabled=true blocking-io=false max-requests-per-connection=0 handle-protocol-mismatch=true ip=* default-virtual-server-name=ha-zone-1 listen-queue-size=128 family=default name=http-listener-1 server-name=ha-zone-1 acceptor-threads=default wadm> start-instance --config=ha-zone-1 localhost CLI204 Successfully started the server instance. wadm> exit |
As you can see above, my old iPlanet admin ways got the better of me, and I started the ha-zone-1 instance via wadm. No matter - it updated its status with SMF anyway. Verifying both services via svcs we can see they’re online:
|
1 2 3 |
# svcs -a | grep http online 21:45:35 svc:/network/http:admin-server online 21:55:41 svc:/network/http:https-ha-zone-1 |
Here, http:admin-server is the administration server instance, listening on port 8989 (with SSL), and http:https-ha-zone-1 is the standard web server instance, listening on port 80.
Next, create some basic probe scripts. Exit statuses should be defined as follows:
|
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
|
I created a directory /opt/probes within the zone, and created two very simple probe scripts. Crappily simple. For Production, do much better please. For my simple tests, these are fine.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# vi probe_iplanet_admin.sh # cat probe_iplanet_admin.sh #!/usr/bin/ksh IPLANET_HOST="localhost" IPLANET_PORT="8989" echo "GET /" | openssl s_client -connect ${IPLANET_HOST}:${IPLANET_PORT} >/dev/null 2>&1 if [ "$?" -eq "0" ]; then exit 0 else exit 100 fi # vi probe_iplanet_instance.sh # cat probe_iplanet_instance.sh #!/usr/bin/ksh IPLANET_HOST="localhost" IPLANET_PORT="80" echo "GET /" | mconnect -p ${IPLANET_PORT} ${IPLANET_HOST} >/dev/null 2>&1 if [ "$?" -eq "0" ]; then exit 0 else exit 100 fi # chmod +x *.sh |
Next, navigate to /opt/SUNWsczone/sczsmf/util, and perform similar steps to registering the zone boot resources (sczbt_{register,config}). Create two copies of the sample (and again, well documented) sczsmf_config file, and update as required:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# cd /opt/SUNWsczone/sczsmf/util # cp -p sczsmf_config sczsmf_config-ha-zone-1-http-admin-smf-res # vi sczsmf_config-ha-zone-1-http-admin-smf-res RS=ha-zone-1-http-admin-smf-res RG=ha-zone-1-rg SCZBT_RS=ha-zone-1-res ZONE=ha-zone-1 SERVICE=http:admin-server RECURSIVE=true STATE=true SERVICE_PROBE="/opt/probes/probe_iplanet_admin.sh" # cp -p sczsmf_config sczsmf_config-ha-zone-1-http-instance-smf-res # vi sczsmf_config-ha-zone-1-http-instance-smf-res RS=ha-zone-1-http-instance-smf-res RG=ha-zone-1-rg SCZBT_RS=ha-zone-1-res ZONE=ha-zone-1 SERVICE=http:https-ha-zone-1 RECURSIVE=true STATE=true SERVICE_PROBE="/opt/probes/probe_iplanet_instance.sh" |
Again, I’ll summarise the configuration directives:
RG- Name of the resourceRG- Name of the resource group containingRSSCZBT_RS- Name of the SC Zone boot resource (e.g.ha-zone-1-res)ZONE- The name of the zoneSERVICE- Either the full FMRI or unique pattern that matches the serviceRECURSIVE-falseto just enable the service and no dependants, ortrueto enable the service and recursively enable dependantsSTATE-falseto not wait until desired service state is reached, ortrueto waitSERVICE_PROBE- path to probe script to check the SMF service
Whilst relative paths work when running sczbt_register - they don’t with sczsmf_register - observe:
|
1 2 3 |
# ./sczsmf_register -f sczsmf_config-ha-zone-1-http-admin-smf-res sourcing sczsmf_config-ha-zone-1-http-admin-smf-res ./sczsmf_register[31]: .: sczsmf_config-ha-zone-1-http-admin-smf-res: cannot open [No such file or directory] |
So, specify the absolute path, and register the SMF resources:
|
1 2 3 4 5 6 7 8 |
# ./sczsmf_register -f /opt/SUNWsczone/sczsmf/util/sczsmf_config-ha-zone-1-http-admin-smf-res sourcing /opt/SUNWsczone/sczsmf/util/sczsmf_config-ha-zone-1-http-admin-smf-res Registration of resource ha-zone-1-http-admin-smf-res succeeded. Validation of resource ha-zone-1-http-admin-smf-res succeeded. # ./sczsmf_register -f /opt/SUNWsczone/sczsmf/util/sczsmf_config-ha-zone-1-http-instance-smf-res sourcing /opt/SUNWsczone/sczsmf/util/sczsmf_config-ha-zone-1-http-instance-smf-res Registration of resource ha-zone-1-http-instance-smf-res succeeded. Validation of resource ha-zone-1-http-instance-smf-res succeeded. |
Next, enable the resources:
|
1 2 |
# clresource enable ha-zone-1-http-admin-smf-res # clresource enable ha-zone-1-http-instance-smf-res |
No errors? Good - check the resource status for the entire resource group:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# clresource status -g ha-zone-1-rg === Cluster Resources === Resource Name Node Name State Status Message ------------- --------- ----- -------------- ha-zone-1-http-instance-smf-res clusternode2 Offline Offline clusternode1 Online Online ha-zone-1-http-admin-smf-res clusternode2 Offline Offline clusternode1 Online Online ha-zone-1-res clusternode2 Offline Offline clusternode1 Online Online - Service is online. ha-zone-1-lh-res clusternode2 Offline Offline - LogicalHostname offline. clusternode1 Online Online - LogicalHostname online. ha-zone-1-hasp clusternode2 Offline Offline clusternode1 Online Online |
All resources are online. Test by browsing to https://ha-zone-1:8989 and http://ha-zone-1. You should see the Administration Console, and the default test page, respectively.
Perform a failover to clusternode2:
|
1 |
# clrg switch -n clusternode2 ha-zone-1-rg |
And verify that you can still hit the webserver. We are done!
Final Task - Quorum Cleanup
As a final task, let’s migrate the quorum device off of the quorum server, and onto one of our shared DID devices. This will enable the quorum server to be decommissioned - making the topology simpler.
This is as simple as adding the new quorum device, removing the old quorum device, and verifying the status:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# clquorum add /dev/did/dsk/d1 # clquorum remove storagehost # clquorum status === Cluster Quorum === --- Quorum Votes Summary from (latest node reconfiguration) --- Needed Present Possible ------ ------- -------- 2 3 3 --- Quorum Votes by Node (current status) --- Node Name Present Possible Status --------- ------- -------- ------ clusternode2 1 1 Online clusternode1 1 1 Online --- Quorum Votes by Device (current status) --- Device Name Present Possible Status ----------- ------- -------- ------ d1 1 1 Online |
Conclusion
This final article in my Solaris Cluster 4.1 “Cluster in a box” series has shown how to bring two zones with their zonepaths on shared storage under cluster control, and how to deploy a highly-available SMF managed service to one of those zones - all managed by the cluster.
It has also briefly shown how to move the quorum device away from the quorum server and onto a shared DID device.
I’ll be writing more about Solaris Cluster as I deploy more services and delve deeper.