[ClusterLabs] Adding Tomcat as a resource to a Cluster on CentOS 7

Oyvind Albrigtsen oalbrigt at redhat.com
Wed Jan 3 04:26:39 EST 2018


On 02/01/18 21:31 +0000, Sean Beeson wrote:
>Hi,
>
>I just wanted to add the solution for future reference.
>
>On CentOS 7 PCS starts and stops Tomcat as a systemd service named
>tomcat at tomcat.service, so  a Unit file for the service in
>/etc/systemd/system/ is needed. The simplest way to create that Unit file
>is to do this on both the primary and secondary-- cp
>/etc/systemd/system/tomcat.service
>/etc/systemd/system/tomcat at tomcat.service.
It's a systemd instance of tomcat at .service, so you dont need
to create a new .service-file.
>
>Kind regards,
>
>Sean
>
>
>On Thu, Dec 7, 2017 at 3:47 AM Sean Beeson <seanbeeson at gmail.com> wrote:
>
>> Hi, Oyvind.
>>
>> Thanks for that lead. I'll try it.
>>
>> Kind regards,
>>
>> Sean
>>
>> On Tue, Dec 5, 2017 at 6:08 PM Oyvind Albrigtsen <oalbrigt at redhat.com>
>> wrote:
>>
>>> On 04/12/17 16:29 +0000, Sean Beeson wrote:
>>> >Thank you for the replay, Oyvind. I gave it plenty of time to start up.
>>> >using  tomcat_name="tomcat" it starts what I can only call a lifeless
>>> PID,
>>> >but it never seems to actually start up. The catalina.out file is never
>>> >touched, so it never has anything in it to indicate a problem. Pacemaker
>>> >does seem to be managing it though because, although this PID shows, it
>>> >will report it as not running and then move everything to the other node.
>>> >It will do that a couple times, but that eventually stops as well.
>>> Try "pcs resource disable <resource>" and then "pcs resource
>>> debug-start --full <resource>". The last command will start the
>>> resource and show you which commands are run, so you can troubleshoot
>>> why it's failing.
>>> >
>>> >Kind regards,
>>> >
>>> >Sean
>>> >
>>> >On Thu, Nov 30, 2017 at 10:40 PM Oyvind Albrigtsen <oalbrigt at redhat.com>
>>> >wrote:
>>> >
>>> >> Tomcat can be very slow at startup depending on the modules you use,
>>> >> so you can either disable modules you arent using to make it start
>>> >> faster or set a higher start timeout via "pcs resource <resource> op
>>> >> start interval=".
>>> >>
>>> >> On 30/11/17 13:26 +0000, Sean Beeson wrote:
>>> >> >Hi, list.
>>> >> >
>>> >> >This is a pretty basic question. I have gone through what I could
>>> find on
>>> >> >setting up Tomcat service as a resource to a cluster, but did not find
>>> >> >exactly the issue I am having. Sorry, if it has been covered before.
>>> >> >
>>> >> >I am attempting this on centos-release-7-4.1708.el7.centos.x86_64.
>>> >> >The pcs I have installed is pcs-0.9.158-6.el7.centos.x86_64
>>> >> >The resource-agents installed is
>>> resource-agents-3.9.5-105.el7_4.2.x86_64
>>> >> >
>>> >> >I have DRBD, MySql, and a virtual IP running spectacularly well and
>>> they
>>> >> >failover perfectly and do exactly what I want them. I can add Tomcat
>>> as a
>>> >> >resource just fine, but it never starts and I can not fined anything
>>> in
>>> >> any
>>> >> >log file that indicates why. Pcs does at some point know to check on
>>> it,
>>> >> >but simply says Tomcat is not running. If I run everything manually
>>> on in
>>> >> a
>>> >> >cluster I can manually get Tomcat to start with systemctl. Here is
>>> how I
>>> >> am
>>> >> >try to configure it.
>>> >> >
>>> >> >[root at centos7-ha-lab-01 ~]# pcs status
>>> >> >Cluster name: ha-cluster
>>> >> >Stack: corosync
>>> >> >Current DC: centos7-ha-lab-02-cr (version 1.1.16-12.el7_4.4-94ff4df) -
>>> >> >partition with quorum
>>> >> >Last updated: Thu Nov 30 21:03:36 2017
>>> >> >Last change: Thu Nov 30 20:53:37 2017 by root via cibadmin on
>>> >> >centos7-ha-lab-01-cr
>>> >> >
>>> >> >2 nodes configured
>>> >> >6 resources configured
>>> >> >
>>> >> >Online: [ centos7-ha-lab-01-cr centos7-ha-lab-02-cr ]
>>> >> >
>>> >> >Full list of resources:
>>> >> >
>>> >> > Master/Slave Set: DRBD_data_clone [DRBD_data]
>>> >> >     Masters: [ centos7-ha-lab-01-cr ]
>>> >> >     Slaves: [ centos7-ha-lab-02-cr ]
>>> >> > fsDRBD_data    (ocf::heartbeat:Filesystem):    Started
>>> >> centos7-ha-lab-01-cr
>>> >> > OuterDB_Service    (systemd:mysqld):    Started centos7-ha-lab-01-cr
>>> >> > OuterDB_VIP    (ocf::heartbeat:IPaddr2):    Started
>>> centos7-ha-lab-01-cr
>>> >> > tomcat_OuterWeb    (ocf::heartbeat:tomcat):    Stopped
>>> >> >
>>> >> >Failed Actions:
>>> >> >* tomcat_OuterWeb_start_0 on centos7-ha-lab-01-cr 'unknown error' (1):
>>> >> >call=67, status=Timed Out, exitreason='none',
>>> >> >    last-rc-change='Thu Nov 30 20:56:22 2017', queued=0ms,
>>> exec=180003ms
>>> >> >* tomcat_OuterWeb_start_0 on centos7-ha-lab-02-cr 'unknown error' (1):
>>> >> >call=57, status=Timed Out, exitreason='none',
>>> >> >    last-rc-change='Thu Nov 30 20:53:23 2017', queued=0ms,
>>> exec=180003ms
>>> >> >
>>> >> >Daemon Status:
>>> >> >  corosync: active/enabled
>>> >> >  pacemaker: active/enabled
>>> >> >  pcsd: active/enabled
>>> >> >
>>> >> >I have tried with and without tomcat_name=tomcat_OuterWeb and tomcat
>>> and
>>> >> >root for tomcat_user=. Neither work.
>>> >> >
>>> >> >Here is the command I am using to add it.
>>> >> >
>>> >> >pcs resource create tomcat_OuterWeb ocf:heartbeat:tomcat
>>> >> >java_home="/opt/java/jre1.7.0_80" catalina_home="/opt/tomcat7"
>>> >> >catalina_opts="-Dbuild.compiler.emacs=true -Dfile.encoding=UTF-8
>>> >> >-Djava.util.logging.config.file=/opt/tomcat7/conf/log4j.properties
>>> >> >-Dlog4j.configuration=file:/opt/tomcat7/conf/log4j.properties
>>> -Xms1024m
>>> >> >-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m" tomcat_user="root"
>>> op
>>> >> >monitor interval="15s" op start timeout="180s"
>>> >> >
>>> >> >I have tried also the most basic.
>>> >> >pcs resource create tomcat_OuterWeb ocf:heartbeat:tomcat
>>> >> >java_home="/opt/java/jre1.7.0_80" catalina_home="/opt/tomcat7"
>>> >> >tomcat_name="tomcat_OuterWeb" tomcat_user="root" op monitor
>>> interval="15s"
>>> >> >op start timeout="180s"
>>> >> >
>>> >> >I other examples I have seen they usually use params then the options
>>> in
>>> >> >these command to add Tomcat as a resource, but when  I use that it
>>> tells
>>> >> me
>>> >> >that is an unrecognized option and it then accepts the options
>>> without it
>>> >> >just fine. I was led to think this was a difference in version of the
>>> >> >resource-agents perhaps.
>>> >> >
>>> >> >Any idea why I can not get Tomcat to start or some lead to the
>>> logging I
>>> >> >could look at to understand why it is failing would be great. Nothing
>>> >> shows
>>> >> >in messages, catalina.out, pcsd.log, nor the resource
>>> >> >log--tomcat_OuterWeb.log. However, it does make the resource log, but
>>> it
>>> >> >only has this in it, which seems to be false:
>>> >> >
>>> >> >2017/11/30 20:50:22: start ===========================
>>> >> >2017/11/30 20:53:22: stop  ###########################
>>> >> >2017/11/30 20:56:22: start ===========================
>>> >> >2017/11/30 20:59:22: stop  ###########################
>>> >> >
>>> >> >The only other thing is: * tomcat_OuterWeb_start_0 on
>>> centos7-ha-lab-01-cr
>>> >> >'unknown error' (1): call=67, status=Timed Out, exitreason='none',
>>> >> >
>>> >> >Again, any ideas would be appreciated. Thank you.
>>> >> >
>>> >> >Kind regards,
>>> >> >
>>> >> >Sean
>>> >>
>>> >> >_______________________________________________
>>> >> >Users mailing list: Users at clusterlabs.org
>>> >> >http://lists.clusterlabs.org/mailman/listinfo/users
>>> >> >
>>> >> >Project Home: http://www.clusterlabs.org
>>> >> >Getting started:
>>> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>> >> >Bugs: http://bugs.clusterlabs.org
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> Users mailing list: Users at clusterlabs.org
>>> >> http://lists.clusterlabs.org/mailman/listinfo/users
>>> >>
>>> >> Project Home: http://www.clusterlabs.org
>>> >> Getting started:
>>> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>> >> Bugs: http://bugs.clusterlabs.org
>>> >>
>>>
>>> >_______________________________________________
>>> >Users mailing list: Users at clusterlabs.org
>>> >http://lists.clusterlabs.org/mailman/listinfo/users
>>> >
>>> >Project Home: http://www.clusterlabs.org
>>> >Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>> >Bugs: http://bugs.clusterlabs.org
>>>
>>>
>>> _______________________________________________
>>> Users mailing list: Users at clusterlabs.org
>>> http://lists.clusterlabs.org/mailman/listinfo/users
>>>
>>> Project Home: http://www.clusterlabs.org
>>> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>> Bugs: http://bugs.clusterlabs.org
>>>
>>

>_______________________________________________
>Users mailing list: Users at clusterlabs.org
>http://lists.clusterlabs.org/mailman/listinfo/users
>
>Project Home: http://www.clusterlabs.org
>Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>Bugs: http://bugs.clusterlabs.org





More information about the Users mailing list