Installing HA Containers With ZFS Using the Solaris 10 5/08 OS and Solaris Cluster 3.2 SoftwareLuke Williams, July 2008 (Updated October 2008) Installing high availability (HA) Containers on ZFS is pretty tricky. The documentation from Sun seems a little incomplete when going over this subject, but for the most part, it points you in the right direction. This article covers the following topics:
Software and Hardware EnvironmentHere is the hardware and software I am running:
Installing the OS and Creating a ZFS PoolFirst things first...install your OS. I set up mine as described in the Software and Hardware Environment section because I have not yet figured out how to get SPARC to boot ZFS. Once that is available, I will be all over that. Until then, I use Solaris Volume Manager to set up my
metadevices and use that to mirror my root and Make sure both nodes look the same and have the same root password and user IDs for your users. That way, when you set up the cluster, everything will work nice and smooth. I then created a ZFS pool called zpool create -f store c0t0d0s7 c1t0d0s7 zfs create store/home zfs set mountpoint=/export/home store/home zfs set sharenfs=rw store/home zfs set quota=10g store/home Connecting SCSI Cables and Resolving SCSI ResetsAfter I set up my initial ZFS pool, I ran into a couple of issues with my JBOD when I first hooked it up to the servers. One issue was that I didn't have enough SCSI cables, so I had to order those as well as another NIC for my interconnect devices. Once I had all that set up, it was pretty straightforward. After I got my SCSI cables, I hooked them up to the JBOD, as shown in Figure 1.
Figure 1: JBOD and SCSI Cables I found I was getting SCSI resets on the bus. This was due to the setenv scsi-initiator-id 5 Then I rebooted both servers and tried to see all the disks. All of them showed up on one server, and none showed up on the other server. So I then ran Installing the Solaris Cluster 3.2 SoftwareI installed the Solaris Cluster 3.2 software. I made sure I installed the core and the following packages:
You can install anything else you want. You just have to make sure you have these packages if you want to have high availability for your zones and ZFS file system. I recommend installing everything; you never know what your cluster will be used for in the future. After you install the Solaris Cluster software, download all the patches and security updates from Sun, so your system is all safe and snug. Then reboot your system after installing the patches. Creating Storage Pools for the ZonesIt is not recommended to place the zone rootpath on a ZFS file system (see Using ZFS on a Solaris System With Zones Installed). This can lead to problems with patch and upgrade scenarios. The Zones will boot properly and function normally, however, performing live upgrades and applying patches to the zone can render the zone unusable. Now we can make the storage pool for our zones. I made one giant zpool create -f tank raidz2 c2t8d0 c2t9d0 c2t10d0 \ c2t11d0 c3t8d0 c3t9d0 c3t10d0 c3t11d0 zfs set mountpoint=/share tank mkdir /share/HA Note: I made the Installing the ClusterNow it is time to install the cluster: /usr/cluster/bin/scinstall Here is a text walk-through on how to set up your cluster. You tell it how many nodes, their names, and how the nodes will talk to each other.
I don't use switches for the interconnects, I just use crossover cables, and I use the default of After both nodes are configured and rebooted, the system comes up in cluster mode, finds all the devices, and sets up a quorum device. At this step in the install "wizard," I tell it I will define the quorum device, which is my 18-Gbyte hard drive in the JBOD with the 2-Gbyte slice. When I ran This command allows you to see all the disks attached to both nodes. I remembered that My system was now a fully functioning cluster with nothing shared and monitored...yet. Setting Up the ResourcesNow we get to the fun stuff, which is actually setting up the resources. This part is the biggest headache, but luckily, Sun has made it pretty straightforward. The first thing you are going to need is a resource group in which to home all the resources that your cluster is going to need. Make sure you are logged in either as root or as a system administrator. First, register the services: clresourcetype register SUNW.HAStoragePlus SUNW.nfs \ SUNW.gds Then create the resource group, with the clresourcegroup create -p PathPrefix=/share/HA tank_rg Here is a brief walk-through of the previous command: You are telling the cluster software to create the resource group I like to keep the naming convention I then set up the logical host name of the server. Note: This name must be in the host file on both nodes, and it must be tied to an IP address. First I set up the host name in 192.168.101.5 logicalname I then save the file using Clreslogicalhostname create -g tank_rg -h logicalname \ logicalname_lh_rs Setting Up the HA StorageNow we set up the HA storage: clresource create -g tank_rg -t SUNW.HAStoragePlus -p \ Zpools=tank tank_hastorageplus_rs Now your storage pool is running under the Solaris Cluster software. You have to start your cluster resource group to see your storage pool again. clresourcegroup online -M tank_rg If you run tank 420037632 7730096 403406064 2% /share Now, before NFS will work, we need to set up a couple of directories and files. Remember how we put mkdir /share/HA/SUNW.nfs cp /etc/dfs/dfstab /share/HA/SUNW.nfs/dfstab.tank_nfs_rs After copying the file, go to the directory and use vi to edit your vi dfstab.tank_nfs_rs share -F nfs -o rw -d "HA NFS File Share" /share/nfs :wq mkdir /share/nfs; chmod 777 /share/nfs Now we create the resource for NFS: clresource create -g tank_rg -t SUNW.nfs -p \ Resource_dependencies=tank_hastorageplus_rs \ tank_nfs_rs Now we have NFS in HA, ZFS storage in HA, and a logical host name all ready for action. Building the ZoneNext we build our zone. It is important to note that when you build your zone, if you share the default directories ( zfs create tank/zones zfs create tank/zones/testzone zfs set quota=5g tank/zones/testzone This will set up the ZFS pool that our zone will live in. I used only 5 Gbytes because all that this test zone will be used for is to check other UNIX servers in my organization for faults and to email me the results. The entire Solaris 10 zone installation uses 3 Gbytes of space, which gives me 2 Gbytes for patches and any other small software I might want to install in the future. Now we set up the zone: zonecfg -z testzone create -b set autoboot=false set zonepath=/share/testzone add net set address=192.168.101.6 set physical=eri0 end verify commit exit Make sure you have Now we install, boot, and configure the new zone: zoneadm -z testzone install zoneadm -z testzone boot zlogin -C testzone Once you have your configuration complete, press ~. to terminate your console session on your zone. Then run the following command: zoneadm -z testzone halt You must halt your zone so that you can run the scripts for installing the zone in HA. Now we have to edit some files so that we can use them to create our zone resource. When you installed HA Containers, it was installed in
Since I only want the zone to boot up and run, I will only use I created a mkdir /share/zones/config I then copied cp /opt/SUNWsczone/sczbt/util/sczbt_config \ /share/zones/config I then used vi to edit the file so that it looked like this: RS=testzone_rs RG=tank_rg PARAMETERDIR=/share/zones/config SC_NETWORK=false SC_LH= FAILOVER=true HAS_RS=tank_hastorageplus_rs Zonename="testzone" Zonebrand="native" Zonebootopt="" Milestone="multi-user-server" LXrunlevel="3" SLrunlevel="3" Mounts="" This is what the previous commands mean:
Now that we are all done writing our boot script, we have to register the resource: clresourcetype register SUNW.gds Now go to /opt/SUNWsczone/sczbt/util/sczbt_register -f \ /share/zones/config/sczbt_config Now you can enable the service: clresource enable testzone_rs Setting Up the Second NodeNow you have your zone up and running in HA. However, you're not quite done yet. You have everything set up only on one node of your cluster. If you fail it over now, everything but your zone will work. You have two small things left to do.
The configuration for your zone is only on one node. We need to get the configuration on to the other node. We will stop the zone resource, use Secure Copy ( On Node 1: Stop the resource for the testzone so we can copy the configuration to the other node. clrs disable testzone_rs zonecfg -z testzone export -f /tmp/testzone.cfg scp /tmp/testzone.cfg node2:/tmp Now we fail over the resource group to the other node and setup the zone. clrg switch -n node2 tank_rg On Node 2: Now we install the zone configuration on this zone and restart the zone resource. zonecfg -z testzone -f /tmp/testzone.cfg zoneadm -z testzone attach -F clrs enable testzone_rs That's it. Your configuration for the zone is copied over. You can now set up your zones to do what ever you want, and they should fail over to the other node with no issues. Enjoy. About the AuthorLucas Williams has been a UNIX and Microsoft Windows system administrator for over 15 years. He has experience with various forms of Linux, the Solaris OS (releases 2.6 through 10), Novell Networking, and Microsoft Windows NT 3.51 through Microsoft Windows Server 2008. He writes scripts to make managing various systems easier and does beta testing of new technologies prior to deploying the technologies into a production environment. Currently, he is working on using virtual technologies to run production-critical systems in a high availability environment. UpdatesOct. 2008: Paragraph added under "Creating Storage Pools for the Zones" Oct. 2008: "Setting Up the Second Node" section revised.
Comments (latest comments first)Discuss and comment on this resource in the BigAdmin Wiki
Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. |
BigAdmin SubscriptionsBigAdmin Areas
BigAdmin Sun Center
BigAdmin Topics | ||||||||||