LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Pacemaker, move VIP when tomcat down (https://www.linuxquestions.org/questions/linux-server-73/pacemaker-move-vip-when-tomcat-down-4175451903/)

arrals.vl 02-27-2013 07:58 AM

Pacemaker, move VIP when tomcat down
 
Hi all,

i have two nodes, each node with tomcat running.
I have assigned an VIP address through IPaddr2.

The problem is that VIP on node1 is not floating to node2 when tomcat is down on node1.

I do not want load balancing.
I just want two servers with tomcat running.
If tomcat on node1 is down for any reason, VIP should go on node2 where tomcat is already running.

thank you very much!!

eantoranz 02-27-2013 01:31 PM

First, I think you should be a little more precise on the headline (something like pacemaker on the headline would help a lot).

Did you set up a "group" that links both tomcat and the IP? What is the output of crm configure show?

arrals.vl 02-27-2013 04:47 PM

Hi,

thank you for replying!

I have two identical nodes with tomcat running on each node and serving the same webpages.
I have set up a VIP address at /etc/sysconfig/network-scripts, and i manually move VIP on node 2 when something is wrong on node1.
I havent configured group of resources, just the tomcat instances for every application.(i will post the configuration tomorrow)

I want to achieve this:

I want to set up an automatic VIP address floating from node1 to node2 in case of tomcat failure on node1, so the node2 will become the active node receiving the requests.

You mentioned Grouping resources. Do you mean to group Tomcat and VIP together?

Thank you very much for helping!

Arvin

eantoranz 02-27-2013 06:07 PM

Perhaps I was wrong. I assumed you were using pacemaker when you talked about IPaddr2:

http://www.linux-ha.org/doc/man-page...a-IPaddr2.html

And grouping:
http://clusterlabs.org/doc/en-US/Pac...roup-resources

If you are solving HA with tomcat itself, then I'm of no help.

arrals.vl 02-28-2013 02:39 AM

Pacemaker, move VIP when tomcat down
 
Hi,

yes, it is pacemaker.
All the applications are running on both nodes.
This is my crm configuration:

Code:

node NODE1
node NODE2
primitive Application1_instance ocf:heartbeat:tomcat \
        params java_home="/usr/java/latest" catalina_home="/usr/local/tomcat" tomcat_user="tomcat" catalina_base="/home/webservices/Application1" catalina_pid="/home/webservices/Application1/logs/catalina.pid" statusurl="http://127.0.0.1:7083" tomcat_name="Application1" \
        op monitor interval="15s" timeout="30s" \
        op start interval="0" timeout="90s" \
        op stop interval="0" timeout="30"
primitive Application2_instance ocf:heartbeat:tomcat \
        params java_home="/usr/java/latest" catalina_home="/usr/local/tomcat" tomcat_user="tomcat" catalina_base="/home/webservices/Application1" catalina_pid="/home/webservices/Application1/logs/catalina.pid" statusurl="http://127.0.0.1:7083" tomcat_name="Application1" \
        op monitor interval="15s" timeout="30s" \
        op start interval="0" timeout="90s" \
        op stop interval="0" timeout="30"
clone Application1 Application1_instance \
        meta globally-unique="false" clone-max="2" clone-node-max="1" target-role="Started" is-managed="true"
clone Application2 Application2_instance \
        meta globally-unique="false" clone-max="2" clone-node-max="1" target-role="Started" is-managed="true"
location Application1_pref1 Application1 0: NODE1
location Application1_pref2 Application1 50: NODE2
location Application2_pref1 Application2 50: NODE2
location Application2_pref1 Application2 0: NODE1
property $id="cib-bootstrap-options" \
        dc-version="1.0.12-unknown" \
        cluster-infrastructure="openais" \
        expected-quorum-votes="2" \
        symmetric-cluster="false" \
        stonith-enabled="false" \
        no-quorum-policy="ignore" \
        last-lrm-refresh="1359541707"
rsc_defaults $id="rsc-options" \
        resource-stickiness="100"

Thank you very much!

eantoranz 02-28-2013 07:57 AM

Perhaps you know things about pacemaker that I don't, not that I'm a pacemaker master, but I don't think that's the way you set this thing up.

First, where's the IPaddr2? Can't see it. Second, you should set up tomcat as a single resource (that is moved from one host to another). Third, you set up a group that binds the IPaddr2 and tomcat resources (and sets up it's starting/stopping order). Assuming that one of those tomcat resources is right (have no experience setting up tomcat), it should be something like:

Code:

primitive ip_address ocf:heartbeat:IPaddr2 params ip="192.168.165.87" cidr_netmask="24"
primitive tomcat ocf:heartbeat:tomcat \
      params java_home="/usr/java/latest" catalina_home="/usr/local/tomcat" tomcat_user="tomcat" catalina_base="/home/webservices/Application1" \
      catalina_pid="/home/webservices/Application1/logs/catalina.pid" statusurl="http://127.0.0.1:7083" tomcat_name="Application1" \
      op monitor interval="15s" timeout="30s" \
      op start interval="0" timeout="90s" \
      op stop interval="0" timeout="30"
group tomcat_service ip_address tomcat

Adjust the parameters of the IP addrs and it should be fine.

arrals.vl 02-28-2013 08:05 AM

Thank you for helping,

i havent setup IPaddr2 yet.
Tomcat is running on both nodes, but only node 1 is serving, the second node is passive.

If i setup a VIP with IPaddr2 and group it with Tomcat, this means that Tomcat on the second(where VIP is not running)node will be stoped, and i dont want this.

am i right?

eantoranz 02-28-2013 08:08 AM

Well... that's how it's supposed to happen. Resources are up on the active host, they are shut down on the inactive nodes.

arrals.vl 02-28-2013 08:11 AM

But i dont want Tomcat to be down on the second node, i want it to be always running, although it is not the node with the VIP.
Would you please give me any ideas?

Thank you!

eantoranz 02-28-2013 08:13 AM

Sure.... why don't you just remove tomcat from pacemaker, start it on all nodes and manage only the virtual IP with pacemaker? Is there a need to relate tomcat (running on all nodes) to the IP somehow?

arrals.vl 02-28-2013 08:23 AM

But what will happen if one tomcat application on node1 (application1 for example) is down for one reason?
The VIP will remain still on node1, and application1 will be down.

I want that VIP floats where the service is up. In this case if application1 is down on node1, VIP to move on node2..

eantoranz 02-28-2013 08:27 AM

Then I don't know how to apply that kind of magic.

arrals.vl 02-28-2013 08:42 AM

Ok, thank you very much for helping !

eantoranz 02-28-2013 08:49 AM

Herhaps you could create a simple script that can be used by pacemaker, like one lsb script (start, stop, status, etc... it's a standard that pacemaker understands.... it doesn't actually start or stop tomcat, it's something like a testing proxy) that could test if tomcat on the active host is actually running. Group it with the IP addr. If tomcat fails, the script should say so to pacemaker so that it can ask the IP addr to move to another host.

arrals.vl 03-01-2013 04:37 AM

Hi,

i am thinking of adding that monitoring script that you suggest on crontab other than grouping it with VIP.
Do you think is best with crontab or group it with VIP?

really thank you for helping!


All times are GMT -5. The time now is 07:45 PM.