Operating System - HP-UX
1833322 Members
3102 Online
110051 Solutions
New Discussion

Re: User login to virtual IP

 
Kenneth Yap
Frequent Advisor

User login to virtual IP

Dear Experts,
I have two node cluster and running on four package.
When the user login using virtual IP, how the user can find out which package that user login to ?
Can it display the package name after user login ?

Thanks
6 REPLIES 6
Rainer von Bongartz
Honored Contributor

Re: User login to virtual IP

Not so easy to solve !!!

I have solved exactly this problem only by using lsof
and checking to which of the virtual ip address the login was directed.

If there is no other (better) way I will post you the corresponding parts of my /etc/profile script
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
James R. Ferguson
Acclaimed Contributor

Re: User login to virtual IP

Hi Kenneth:

I'm not sure I fully understand your question. If you want to know upon which node a particular package is running, then you can issue a 'cmviewcl' and parse the output. The concept of the virtual (floating) IPaddress is that the client is oblivious (as they should be) to the exact hardware on which they are running.

Remember to list non-root users in /etc/cmcluster/cmclnodelist if you want them to be able to run 'cmiewcl'.

...JRF...
Kenneth Yap
Frequent Advisor

Re: User login to virtual IP

Hi Rainer ,

Can you send me your "profile" file for testing ?
My email ytmeng@maxis.net.my

Thanks
Magdi KAMAL
Respected Contributor

Re: User login to virtual IP

Hi keneth,

I used a work arounf manner by which I knew on which package I am.
This is also useful when you run generic scripts from crontab and you want that certain commands runs for specific package.

This solution is based on the filesystem activation.

Consider packages A, B and C :

A : activates fs1
B : activates fs2
C : activates fs3

The "df -k" ( mount or bdf )command reports only activated filesystems for current package on specific node.

The command :

for fsname in `df -n | grep 'vxfs|hfs' | awk ?{print $1}?`
do

case $fsname in
"fs1")
echo "### I am in package A"
cmd1...cmdn
;;
"fs2")
echo "### I am in package B"
cmd1 ... cmd m
;;
"fs3")
echo "### I am in package C"
cmd1 ... cmd m
;;
esac
done

Magdi

Rainer von Bongartz
Honored Contributor

Re: User login to virtual IP


Magdi,

But this does not work if all three packages are running on your node.

You will always execute your cmds for all three packages.
I understood that Kenneth wanted to do the following:

User telnets to virt_ip_add1 ; login ; run commands specific to package 1.

User telnets to virt_ip_add2 ; login ; run commands specific to package 2.

The only way I could manage this was to use lsof to find out to what virt_ip_addr the telnet was directed too.

Regards
Rainer


He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Magdi KAMAL
Respected Contributor

Re: User login to virtual IP

Hi Rainer,

I agree with you for this case.

In my reply, I supposed that the sysadmin will not put all packages on a single node ( for load balancing reasons, that's what I do in production ) but will distribute them on all nodes.

Anyway, considering more than one package on the same node will be confused with my example.

Rgds.

Magdi