Назад | Перейти на главную страницу

mod_jk быстрое переключение при отказе Tomcat, медленное при отказе хост-сервера

У меня есть две виртуальные машины, на каждой из которых размещен сервер Signle Tomcat (с активным соединителем AJP). Я включил липкую сессию.

  1. Когда я выключаю сервер Tomcat, который в данный момент активен, переключение происходит быстро;
  2. Однако когда я выключаю виртуальную машину, к которой я подключен, отработка отказа занимает минимум 40 секунд, прежде чем перенаправить меня на сервер UP / tomcat или выдать ошибку 502 bad gateway.

Есть идеи, почему поведение в каждом случае разное?

К вашему сведению, снижение worker.node1.maintain не помогает.

Конфигурация моих рабочих ниже.

# Workers definication
worker.list=loadbalancer

# Worker 1
worker.node1.connection_pool_timeout=300
worker.node1.ping_mode=I
worker.node1.ping_timeout=2000
worker.node1.connection_pool_timeout=20
worker.node1.connection_pool_size=40
worker.node1.max_reply_timeouts=0
worker.node1.maintain=10
worker.node1.recovery_options=3
worker.node1.lbfactor=1
worker.node1.type=ajp13
worker.node1.socket_timeout=120
worker.node1.socket_keepalive=true
worker.node1.port=8009
worker.node1.host=192.168.56.105
worker.node1.prepost_timeout=2000


# Worker 2
worker.node2.connection_pool_timeout=300
worker.node2.ping_mode=I
worker.node2.ping_timeout=2000
worker.node2.connection_pool_timeout=20
worker.node2.connection_pool_size=40
worker.node2.max_reply_timeouts=0
worker.node2.maintain=10
worker.node2.recovery_options=3
worker.node2.lbfactor=1
worker.node2.type=ajp13
worker.node2.socket_timeout=120
worker.node2.socket_keepalive=true
worker.node2.port=8009
worker.node2.host=192.168.10.3


# Load-balancing behavior
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.retries=1
worker.loadbalancer.recover_time=5
worker.loadbalancer.method=B
worker.loadbalancer.sticky_session=true

журнал mod_jk:

[Wed Jan 29 18:08:34 2020][15324:14712] [info] ajp_handle_cping_cpong::jk_ajp_common.c (976): (node2) timeout in reply cpong after 2000 ms. Socket = 1156 (event=60)
[Wed Jan 29 18:08:34 2020][15324:14712] [info] ajp_send_request::jk_ajp_common.c (1651): (node2) failed sending request, socket -1 prepost cping/cpong failure (errno=60)
[Wed Jan 29 18:08:34 2020][15324:14712] [info] ajp_send_request::jk_ajp_common.c (1709): (node2) no usable connection found, will create a new one, detected by connect check (0), cping (1), send (0).
[Wed Jan 29 18:08:55 2020][15324:14712] [info] jk_open_socket::jk_connect.c (816): connect to 192.168.10.3:8009 failed (errno=60)

[Wed Jan 29 18:08:55 2020][15324:14712] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1065): (node2) Failed opening socket to (192.168.10.3:8009) (errno=60)
[Wed Jan 29 18:08:55 2020][15324:14712] [error] ajp_send_request::jk_ajp_common.c (1725): (node2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Wed Jan 29 18:08:55 2020][15324:14712] [info] ajp_service::jk_ajp_common.c (2775): (node2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Wed Jan 29 18:09:16 2020][15324:14712] [info] jk_open_socket::jk_connect.c (816): connect to 192.168.10.3:8009 failed (errno=60)

[Wed Jan 29 18:09:16 2020][15324:14712] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1065): (node2) Failed opening socket to (192.168.10.3:8009) (errno=60)
[Wed Jan 29 18:09:16 2020][15324:14712] [error] ajp_send_request::jk_ajp_common.c (1725): (node2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Wed Jan 29 18:09:16 2020][15324:14712] [info] ajp_service::jk_ajp_common.c (2775): (node2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Wed Jan 29 18:09:16 2020][15324:14712] [error] ajp_service::jk_ajp_common.c (2796): (node2) connecting to tomcat failed (rc=-3, errors=4, client_errors=0).
[Wed Jan 29 18:09:16 2020][15324:14712] [info] service::jk_lb_worker.c (1601): service failed, worker node2 is in error state
[Wed Jan 29 18:09:16 2020]loadbalancer mylocalserver.local 44.203511

Спасибо