Operating System - HP-UX
1832247 Members
2336 Online
110041 Solutions
New Discussion

Re: how to reset the host name in a applicatoin conf file in SG failover?

 
Hanry Zhou
Super Advisor

how to reset the host name in a applicatoin conf file in SG failover?

We have a application running on 2-node SG, and one of app. configuration files contains the host name where the app. is running on.

When we manually switch the package by using sg cmmands cmhaltpkg, and cmrunpkg, every thing is fine, and the host name in the app. is correctly refected. However, when we panic the node a, for instance, the package did fail over to node b, but the problem is that the app. configuration file still contains the name of node a, where it should be changed to node b.

How do we resolve the problem. I'm thinking we should add a few statements in the package control script, to manually set the host name in the applicatoin conf file. But how?

Please let me know. Thanks!
none
10 REPLIES 10
Geoff Wild
Honored Contributor

Re: how to reset the host name in a applicatoin conf file in SG failover?

Well...you could have an environment file that is on the share disk somewhere - and have the package control script read during startup...

customer_defined_run_commands

. /path/to/shared/disk/packagename.env


And in that file,

HOST=`uname -n`
export $HOST

Something like that...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: how to reset the host name in a applicatoin conf file in SG failover?

Course what am I thinking...don't really need an environment file...just put:

HOST=`uname -n`
export $HOST

in the customer_defined_run_commands...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Hanry Zhou
Super Advisor

Re: how to reset the host name in a applicatoin conf file in SG failover?

Should be like this:

hostname > /full/pathof/theapplication/file


in the custom_defined_run_cmds function.

Is this right?
none
Sanjay_6
Honored Contributor

Re: how to reset the host name in a applicatoin conf file in SG failover?

Hi,

Try not to use the hostname. If possible try to use the application to attach to a IP which could be the floating ip of the package.

Take a look at this from hp docs on SG,

http://docs.hp.com/en/B3936-90073/apcs03.html

Hope this helps.

Regds
Hanry Zhou
Super Advisor

Re: how to reset the host name in a applicatoin conf file in SG failover?

Sanjay,
You probably don't understand the issue here.

It is the applications requiring the node name where it is going to be started. So, we have to use the host name in the application configuration file, otherwise, the it won't be started.

none
Geoff Wild
Honored Contributor

Re: how to reset the host name in a applicatoin conf file in SG failover?

I agree with Sanjay - maybe you can tell us why the application needs the hostname of the node?

In my SG environments - users and apps point to the dns name of the floating ip's....

For example, my nodes are svr0003 and svr0004 - but the app only points to prddbci - which is the floating ip address of the package...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Hanry Zhou
Super Advisor

Re: how to reset the host name in a applicatoin conf file in SG failover?

Well, I don't know why application needs the host name to start up, but on the way to start it up, it does check the node name somehow captured in the application file. It only happens when I panic the sever by kill cmcld. When I manually switch the packag over, the pkg is able to be started.

Let me ask you this question though. When system panic, and reboot itself, Did customer_define_halt_cmds get the chance to be executed?
none
Geoff Wild
Honored Contributor

Re: how to reset the host name in a applicatoin conf file in SG failover?

Nope - on a panic - halt commands do not run - node goes down hard....in an effort to maintain data integrity...



Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: how to reset the host name in a applicatoin conf file in SG failover?

As far as this goes:

hostname > /full/pathof/theapplication/file

Sure that would work...

Another thing you could do - is maintain 2 copies of "file" say in /etc - and make /full/pathof/theapplication/file a symbolic link to /etc/file

Only diffenernce between file on nodea and nodeb - the hostname.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Hanry Zhou
Super Advisor

Re: how to reset the host name in a applicatoin conf file in SG failover?

I believe what happend here is when the system in panic mode, the shared drive is switched to the failover node, along with that file conaiting the host name. So, when the package is started on the failover node, the file sitll contains the primary node name, and since the application does check the file, so, when he find the name in it is different than where the package is really located, the applicatoin therefore won't be started.

I guess, the only solution here is direct the right node name in the file everytime when the package is started which could be performed in the cutomer_run_cmds function.
none