JK Status Manager(status worker) of mod_jk1.2.32 d

2019-06-09 05:30发布

问题:

My application is using Apache,mod-jk and Tomcat for load balancing, which works fine with this work.properties:

worker.list=workerlist
# Set properties for worker3
worker.worker3.type=ajp13
worker.worker3.host=xxxx
worker.worker3.port=xx
worker.worker3.lbfactor=4
worker.worker4.ping_mode=A
worker.worker3.socket_timeout=30
worker.worker3.reply_timeout=30000

# Set properties for worker4
worker.worker4.type=ajp13
worker.worker4.host=xxxx
worker.worker4.port=xx
worker.worker4.lbfactor=4
worker.worker4.ping_mode=A
worker.worker4.socket_timeout=30
worker.worker4.reply_timeout=30000

# Set properties for workerlist(lb)
worker.workerlist.type=lb
worker.workerlist.balance_workers=worker4,worker3
worker.workerlist.sticky_session=1

worker.list=jkstatus
worker.jkstatus.type=status

What happens is that when I shutdown the worker4(Tomcat), the web interface of JK Status Manager(http://apachehost/jkstatus) still shows the worker4 is in ACT and OK/IDLE State, which makes no sense because the worker4 is no longer available. And I don't see any error message in the mod-jk.log.

However, when I change the worker.properties to have only the unavailable worker4 and try access again, the page shows the ERR Satte:

The mod-jk.log shows:

[error] ajp_service::jk_ajp_common.c (2626): (worker4) connecting to tomcat failed.
[info] service::jk_lb_worker.c (1400): service failed, worker worker4 is in error state
[info] service::jk_lb_worker.c (1480): All tomcat instances are busy or in error state
[error] service::jk_lb_worker.c (1485): All tomcat instances failed, no more workers left

My questions are:

  • According to Service Availablity Rating on Tomcat's website, it says "OK (idle): This worker didn't receive any request since the last balancer maintenance. By default balancer maintenance runs every 60 seconds. The worker should be OK, but since we didn't have to use it for some time, we can't be sure. This state has been called N/A before version 1.2.24.". What I understand from this is mod-jk itself would maintain the connection automatically. So why not the JK Status Manager give me alert if one of the worker is down? Does the maintenance not work or the JK Status Manager website not work properly?

  • Besides JK Status Manager, is there other way to monitor the status of workers in real time? I mean if one server is down, I'd like to know immediately.

  • Does the ping_mode have to be set explicitly?Is it default "A"? The log said that: [warn] jk_map_handle_duplicates::jk_map.c (446): Duplicate key 'worker.worker4.ping_mode' detected - previous value 'A' will be overwritten with 'A'.

回答1:

1) If one Tomcat worker fails, nothing is happening until the next check of your balancer. Therefore OK/Idle is displayed. After 60 seconds it should turn into Err state.

2) There are for sure other tools and that page is just an info and not form management. The easiest way would be to set up a servlet, that responses HTTP_200 status. You can check its availability i.e. with an URL object, from an external program.

3) That message is displayed, because you have a typo in your config in line 7 (worker4 instead of worker3):

worker.worker4.ping_mode=A