Showing posts with label svccfg. Show all posts
Showing posts with label svccfg. Show all posts

Monday, April 20, 2009

Prepping For Setting Up VCS NFS Clustering On Solaris 10

Hey there,

Hope your work week is beginning swimmingly :) Mine is kind of like the end of last week, although that sentence is a bit of a non sequitur. I actually haven't stopped working, so it still is last week this week (???) You know what I mean (Although, I hope that you don't ;)

Today we're going to look at preparing your Solaris 10 system for clustering NFS (The Network File System ... the "The" is silent ;) on VCS (Veritas Cluster Server). In many ways, it's the same as setting it up on previous versions of Solaris, but it differs in many ways, as well. Apparently, I spend way too much time looking at this issue in many many ways ;)

NOTE: This post is kind of a wrapper around our previous posts on adding NFS to an existing VCS cluster and adding NFS to a VCS cluster with no down time. You can check either of those out if you want to read up on doing the VCS configuration part of the "VCS NFS" setup. This post is of purely a preparatory nature (with, admittedly, some post-installation test steps and a pointer to another old post on an uncommon Solaris 10 VCS NFS error and how to fix it).

1. First, we'll do the Solaris 10 setup. This is very important, since the SMF (Soul Macerating Futility or, possibly, Service Management Facility) has changed the way in which "services" and "run levels" are either dealt with or completely subverted ;)

a. If you're going to be depending on VCS for NFS management, it will interest you to know that VCS won't have anything to do with NFS if you want to use it on your own (on the same machine). For that reason, we're going to use svccfg to "delete" the following services, rather than using svcadm to "disable" them.

host # svccfg delete -f svc:/network/nfs/server:default
host # svccfg delete -f svc:/network/nfs/mapid:default
host # svccfg delete -f svc:/network/nfs/status:default
host # svccfg delete -f svc:/network/nfs/nlockmgr:default


b. Doing the above may (actually, should) kill the lockd and statd daemons that are probably already running (I'm trying not to be too presumptuous ;) If that's the case, you'll need to start those up again.

host # (/usr/lib/nfs/lockd &)
host # (/usr/lib/nfs/statd &)


VCS will take care of starting them once it's good to go.

If the above way of starting those services from the command line seems goofy, check out our aging post on what to do when nohup hangs up anyway from way back when. It's a fair read and may still be interesting to a certain degree ;)

c. Finally, you just need to make one directory, for convenience's sake (and also so that the "NFSRestart" resource will actually work):

host # mkdir /opt/VRTSvcs/lock

2. Now (whooshing right past the "actual" VCS NFS setup (referenced above from two previous posts on that subject), you're ready to do a few simple tests.

a. Once you have NFS running on VCS on your primary node, pick another node (we'll just assume you picked the secondary) and test that the NFS mount is up and working like VCS says it is (You can't always take it at its word):

host2 # showmount -e host
export list for host:
/that/vcs/nfs/directory/share (everyone)


Then just make sure you can actually mount the share.

b. Then fail over to your secondary node and run the same test on the primary:

host # showmount -e host2
export list for host2:
/that/vcs/nfs/directory/share (everyone)


Again, mount the share just to be sure everything's in working order.

c. If you encounter an error while running "showmount" on either server, like this:

showmount: host: RPC: Rpcbind failure - RPC: Authentication error

accompanied by your being able to generate this error (although, not necessarily):

host # rpcinfo -p host
rpcinfo: can't contact portmapper: RPC: Authentication error; why = Failed (unspecified error)


be sure to check out our previous post on this little Solaris 10 VCS NFS gotcha and, hopefully, you'll end up knowing more than you ever wanted to about how to straighten that out :)

And, finally, in an out-of-sequence-series of only four posts, you're finally done setting up NFS in VCS on Solaris 10. Hopefully, you finished a long time ago. It's been six months since some of the referenced posts were originally published. Over time, it gets getting harder and harder to dot all the i's on this blog ;)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, February 5, 2009

A Little VCS NFS Gotcha On Solaris 10

Hey again,

We're going back to the Solaris 10 Unix well, reaching back a little (as opposed to the 14 month reach-back we did yesterday ;) and adding a little something to our posts on adding NFS management to an existing VCS cluster as well as the follow up on how to do the exact same thing without taking your VCS cluster offline. Today's post is actually another little bit of fix-it knowledge to keep in the back of your hat (if that's even an expression anyone's ever used... if not, consider it © ® ™ us ;). And, of course, this piece of knowledge came to everyone by accident. Actually, by virtue of an accident... the answer was found methodically... I think ;)

In any event, after extensively field-testing the methods espoused in the earlier posts referenced above, a deployment of clustered servers to an offsite location ended up having an issue that we weren't able to anticipate (or cause to occur in previous cookie-cutter-similar deployments). For some reason, when we rolled this cluster out, NFS just refused to work in a failover capacity. Actually, it only failed, specifically, to allow the main node to mount on the failover node. This problem seems pedestrian (even still ;) - the only odd thing was that it had never happened before under equal circumstances.

Here's what we figured out along the way (and how to fix it, too ;) For our purposes today (and the way it was then) the NFS cluster component works fine on node-b, but node-a can't mount the NFS resource when it fails over to node-b.

1. The first thing most people do in any investigation is to see if the basic stuff is all up and running. We don't like to be different, so we duly checked that all of the required VCS resources were up and online. They were; which explained the puzzling ONLINE state ;)

2. We then proceeded to ensure that, in fact, node-b was sharing out the NFS resource. Commands like showmount indicated that it, indeed, was. A little research into the subject showed that the issue we ended up having can indicate an RPC failure at this point, as well, but it's best to try step 3, too, just to be sure the problem isn't confined to a single server (although the fix for it is the same no matter which way your story goes ;)

3. Then we finally struck gold, and got an actual error, when we tried to hit the mount from node-a:

node-a # showmount -e node-b
showmount: node-a: RPC: Rpcbind failure - RPC: Authentication error
node-a # rpcinfo -p node-b
rpcinfo: can't contact portmapper: RPC: Authentication error; why = Failed (unspecified error)


4. Unspecified errors are the best kind of errors you can get since there are a much wider variety of possible solutions you can come up with... Or, maybe I have that backwards... There's really not much more to step 4. This step is a practice in surrealism ;)

5. It turns out that the answer lay in setting rpcbind properties (away from the defaults on both servers). The answer to the problem (or the fix, if you will) actually makes more sense than the way things "usually" work. The first thing we did was to set rpcbind to "global" on both nodes. By default, it was set to "local_only." We double confirmed that this is still the case on other cluster setups we have running, in which everything is hunky-dory. You also need to do these steps on both nodes (or all nodes) in your cluster, while, here, we're only showing what we typed on the active NFS resource-sharing node:

node-b # svcprop network/rpc/bind:default | grep local_only <-- See if the local_only property is set
config/local_only boolean true <-- and there it is!

then move on to fixing the problem (again on both nodes) by setting the rpcbind configuration value to global (which, in the instance of rpcbind, actually means setting the local_only attribute to "false"):

node=b # svccfg
svc:> select network/rpc/bind
svc:/network/rpc/bind> setprop config/local_only=false
svc:/network/rpc/bind> quit


6. Then, just double check to make sure you've gotten it all set up correctly:

node-b # svcprop network/rpc/bind:default | grep local_only
config/local_only boolean true


...well, that's not right, but don't give up just yet! Keep typing. Type, Forrest, Type! ;)

node-b # svcadm refresh network/rpc/bind:default
node-b # svcprop network/rpc/bind:default | grep local_only
config/local_only boolean false


there... that's better.

7. Finally, just make sure you can mount your NFS resource from whichever node isn't currently hosting the NFS resource. You don't necessarily have to test it on both nodes, once you've fixed this issue on both, but why risk the near-future embarrassment?

node-a # showmount -e node-b
export list for node-b:
/our/shared/directory (everyone)


And that's that. You should be good to go :) Since all's well that ends well, we'll try not to leave you with any clichés in our farewell. Parting is, after all, such sweet sorrow. At least until tomorrow :)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, January 26, 2009

Adding NFS Management To An Existing VCS Cluster - Part One

Hey there,

Today we're going to take a look at a subject we've covered a bit in the past. If, after reading today's post, you want to things the quick and dirty way, check out our previous post on manually editing the main.cf file.

Today's task, although it sounds grim (since it involves VCS, mostly ;), is actually fairly simple to do and can be done in at least two different ways.

For today's purposes, we're going to show one of those ways and we're going to assume (per the title) that we're going to add an NFS resource to an existing VCS cluster on Linux or Unix (with special notes for any OS-specific steps). We're also going to assume that we're dealing with a two-node cluster since that's easier to write about and cuts down on my over-explanation ;) Also, we've disabled all NFS services on the host OS (meaning that we've stopped them and removed them from init scripts so that the OS won't try to manage them itself! A simple "ps -ef|grep nfs" check before you proceed should show you any remaining running nfs programs which you should kill)

1. The simple way (according to me :)

a. Bring down your entire VCS cluster (all nodes) from the node that you'll be doing the modification of the main.cf file on. It's VERY IMPORTANT that you use the -force flag when running the "hastop -all" command, as this will cause VCS to go down, but won't affect any of the applications running. To put it another way, if you just run "hastop -all" without the -force flag, VCS will go down on all of your cluster's nodes cleanly and bring down all the resources it manages with it. We want to do this as covertly as possible.

host # hastop -all -force

b. Now, proceed to edit your main.cf file. To totally cover our arses, we're going to make a quick backup of main.cf and copy the existing version into a new directory to do our edits:

host # cp main.cf main.cf.`date +%m%d%y`
host # pwd
/etc/VRTSvcs/conf/config
host # mkdir tmp
host # cp main.cf tmp/.
host # cd /etc/VRTSvcs/conf/config/tmp
host # vi main.cf


c. Make the changes and save (Note that you don't have to add any additional "includes" - like types.cf - to the file, as the NFS resource is already supported in the existing types.cf include file). All additions here should be made within the service group that the NFS resource will be a member of. Our service group is going to be called SG (there I go, getting all creative again ;). Add the following lines within the service group definition. These should be added after the SystemList definition, which I've kept in the example (but you don't need to modify), here:

group SG (
SystemList = { host1 = 0, host2 = 1 }
AutoStartList = { host1 }
)

NFS NFS_server_host1 (
Critical = 0
)

NFSRestart NFS_nfsrestart_host1 (
Critical = 0
NFSRes = NFS_server_host1
LocksPathName = "/opt/VRTSvcs/lock"
NFSLockFailover = 1
)

Share SHR_sharename_host1 (
Critical = 0
PathName = "/your/nfs/shared/directory"
Options = "rw,anon=0"
)

NFS_nfsrestart_host1 requires hostip1
SHR_sharename_host1 requires MNT_mount1_host1
SHR_sharename_host1 requires NFS_server_host1


You'll note that I set all of the new entries to non-critical (Critical = 0), since VCS's default is to make the resource critical, which would mean that, if we made mistake, the NFS resource bombing would cause a failover that we don't want. You can, and should, remove this line once you know everything is good. Also, check out the 3 new dependency-tree lines I've added. You don't need to modify the pretty commented version that VCS creates automatically; just the 3 basic dependencies (or requirements) that your NFS resource should rely on.

d. Now, we just need to check our new configuration to make sure it's syntactically correct:

host # hacf -verify /etc/VRTSvcs/conf/config/tmp/main.cf

if this shows any errors, fix them and run this command again until it just returns you to a blank prompt. Although it can be aggravating, VCS' hacf command doesn't tell you anything if it thinks the main.cf is fine ;)

e. Since everything went well, we just need to move our new main.cf file into its proper location (/etc/VRTSvcs/conf/config/). We've already backed up the original, earlier, so - if things get nuts, or the addition causes problems - we can switch back to the working configuration fairly quickly.

host # pwd
/etc/VRTSvcs/conf/config/tmp
host # mv main.cf ../.


f. Now, we just need to start up VCS again.

IMPORTANT NOTE: Only start VCS on the node on which you did your edits. Do not start it on any other nodes until the node you're working on is up and running VCS without errors. You can check the status of your host's VCS processes using either "hastatus -sum" over and over again, or just "hastatus" which provides information in real time, but is slightly more confusing to read than the output of "hastatus -sum." If you get an error about the "lock" file, just touch (create it yourself) the file you named as your lockfile in the new main.cf. You can touch it even if it exists, just to be sure, without causing any issues:

host # touch /opt/VRTSvcs/lock
host # hastart


g. Now that we've established the VCS is running fine on our main node, we can start up the other node(s). "hastatus -sum" and "hastatus" will show them (at an early point) in a REMOTE_BUILD state. This indicates that they're updating their main.cf's to match the one that we just changed.

Voila! All set. Once you're happy, be sure to set the NFS resource to "critical," if you want that. It's as easy as typing these commands on the command line (again, on your main node, if possible):

host # haconf -makerw
host # hares -modify NFS_server_host1 Critical 1
host # hares -modify NFS_nfsrestart_host1 Critical 1
host # hares -modify SHR_sharename_host1 Critical 1
host # haconf -dump -makero


A special note for Solaris 10 users: If you want to use VCS to manage your NFS resources, you'll need to delete certain resources from the SMF framework. The following commands should do the trick for you:

host # svccfg delete -f svc:/network/nfs/server:default
host # svccfg delete -f svc:/network/nfs/status:default
host # svccfg delete -f svc:/network/nfs/nlockmgr:default


Tomorrow, we'll take a look at another way to do this without taking VCS down :)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, August 11, 2008

Changing Solaris Run Levels And Clearing Up Some Common Misconceptions

Hey there,

Today's post hearkens back to an earlier time, when I was administrating Solaris 2.4 and figured Sun had big plans for run level 4. It was, after all "reserved for future use." I don't know about you, but (to this day) when I see terminology like that, I tend to shy away from getting too comfortable with working in a cheap hack. My thinking was that, at some point (given Sun's policy at the time) they'd come up with a unique use for run level 4 and I'd have a whole lot of stuff set up to launch from there and my world would be thrown into chaos ;)

I no longer worry too much about the chaos (something, somewhere is going to break or I'll eventually be out of a job ;), but I still like to keep tabs on Solaris' "level 4" status updates and their command run-level policies. So, today, we'll take a brief look at "run level 4" and then look at a few commands, used to change run levels, that may not act as you would expect.

1. Run level 4: It is still, technically, reserved for future use on Solaris. However, the subtle difference in meaning over time has been stated more clearly with the last few releases. Now, about half of the places you look (on Sun's Documentation Site) list "run level 4" as being "user-defined." What this means, aside from the fact that any admin can make use of it if he or she deems it worthwhile, is that I spent a lot of time worrying about nothing. Of course, I'm willing to forgive, since I never had any use for "run level 4" anyway.

On most Linux and Unix distro's, run level 4 is considered open and user-definable. In a few instances, on HP-UX and Slakware, among others, run level 4 is the default run level for the X-Windows display manager. Generally, this is found on run level 5. But, before I go crazy over-explaining, check out Wikipedia's entry on run levels for virtually every system known to man :)

The only thing you have to make sure of, for the most part, if you want to use Solaris' run level 4 is that you create an entry for it in /etc/inittab. Something like:

s4:4:wait:/sbin/rc4 >/dev/msglog 2<>/dev/msglog </dev/console



would probably suffice for distributions up to, and including Solaris 9. If there are minor differences in your distribution, you can simply copy the line for "s3," paste it below and change all the 3's to 4's. Fairly simplistic, but without it, Solaris' init will never know to look there and will not know what you mean when you try to change to run level 4.

On Solaris 10, things are a little goofier, but in a good way. You can mess around with the inittab and set things up that way, but if you use the "out-of-the-box" configuration and stick with the Service Management Facility (SMF), you won't need to worry about that. SMF has no concept of run levels and doesn't need /etc/inittab. Since SMF handles the order of starting services (with dependencies), you don't need to have a "separate" run level to accomplish whatever end you were shooting for. You can add new services with SMF and then goof around, to your heart's content, with svcadm, svccfg, svc.configd, etc. You may find yourself longing for the "old ways" until you get used to it.

2. Some command run level changing commands and what they're limited to: Some of this stuff still surprises me, since it seems counter-intuitive, but I guess I've always been lucky in the way I start stuff up and shut it down (my apologies to Clint Eastwood for bastardizing his famous quote from "Unforgiven" ;) Plus, I'm a big fan of "init" :) We're going to forget run level 4 exists for most of this part since it rarely matters... technically...

a. init: This command can be used to bring Solaris to any run level you specify (0, 1, s, S, 2, 3, 4, 5 and 6). This is a bone of contention, if you ever have to get certified, but Sun says there are only 8 run levels, of which only 7 are used. If you count "s" and "S" as separate (even though they both do the same thing) I would back you up if your answer was 9.

b. reboot: This command can only bring the system to run level 6. However, you can make reboot take you to other places by terminating the getopts routine and adding a flag afterward, so that:

host # reboot -- -s

would allow you to use the reboot command to get into single user mode. Also, another reason this perplexes me as much as it does is that, technically, bringing the machine to run level 6 entails the system going through a series of run levels leading all the way to the default run level (which is 3, if you left it alone). Sun's answer is technically true, but somewhat misleading. The only thing you really "can't" do with reboot is stop at run levels 0, 1, 2 and 5 (unless you make one of them your default run level in /etc/inittab - not a good idea, especially for 0 and 5 ;)

c. shutdown: This command can only bring the system to run levels 0, 1, s/S, 5 or 6. This makes sense to a degree, since run level 6 is reboot, 5 is power-off and 0 is PROM. I don't understand why it can shut the system down to run level 1 (single user with all local filesystems mounted read-write) and s/S (single user with only / mounted read-only) and not shut it down to run level 2 (basic multi-user with network) from run level 3 (same multi-user with nfs and some additional network services) straight up. As noted above, regarding reboot, you can actually make this command take you to any run level except 2 (unless you set that as your default run level in /etc/inittab)

d. poweroff: This command can only bring the system to run level 5. Perfectly sensible.

e. halt: This command can only bring the system to run level 0. This makes sense, too.

f. uadmin: This command can only bring the system to run levels 0, 5 and 6 (see above regarding why run level 6 means you can also use this command to get to run level 3, or your system default run level, as well). This command is restricted to super-user access by default. For the longest time I thought it could get you to any run level straight off, although I never needed to use it except to dump the system. An interesting fact about uadmin is that it can accept arguments. Which means, if you're feeling moderately clever, you can make it go places Mother won't let it go, by fudging it a little. Consider the following, understanding that uadmin converts arguments into integers as such, and is invoked as "uadmin command function optarg":

commands:

1 = No Disk Sync
2 = Sync Disks

functions:

1 = A_REBOOT <-- Run level 6
2 = A_SHUTDOWN <-- Run level 0
5 = A_DUMP <-- Run level 5

optional arguments:

Try whatever you want out, if you can afford to. Be sure to enclose an argument with spaces in double quotes.

host # uadmin 1 1 "-s kernel/unix" <-- Basically any option you can pass to the PROM "boot" command, you can sneak in here!

also, there are multiple versions of uadmin available, depending on your Solaris release, so you may be looking at these set of options, which will get you to run levels 0, s/S, 1, 2, 5 and 6 (which gives you run level 3) as well as allowing you the optional argument:

uadmin 2 0: sync the filesystems and drops system to ok prompt
uadmin 2 1: sync the filesystems and reboots to multi-user mode
uadmin 2 2: sync the filesystems and reboots interactively
uadmin 2 3: sync the filesystems and reboots to single-user mode
uadmin 2 6: sync the filesystems and powers off the system

uadmin 1 0: do not sync filesystems and drops system to ok prompt
uadmin 1 1: do not sync filesystems and reboots to multi-user mode
uadmin 1 2: do not sync filesystems and reboots interactively
uadmin 1 3: do not sync filesystems and reboots to single-user mode
uadmin 1 6: do not sync filesystems and powers off the system

Now, let's kick back and let the raging debate about OS version-and-release accuracy begin ;)

Cheers,

, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.