LoginSignup
2
0

More than 3 years have passed since last update.

CentOS7 HAProxyの接続エラー

Last updated at Posted at 2019-10-06

エラー

Oct  6 12:35:03 localhost haproxy[25984]: Server redis-master/<name> is DOWN, reason: Layer7 timeout, info: " at step 1 of tcp-check (send)", check duration: 2002ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
----
Oct  6 12:35:03 localhost haproxy[25984]: Server redis-slave/<name> is DOWN, reason: Layer7 timeout, info: " at step 1 of tcp-check (send)", check duration: 2002ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.

L4 ロードバランサーとして使用する際に、なぜかL7でtimeoutが発生し接続できなかった。

バージョン

  • CentOS Linux release 7.7.1908 (Core)
  • haproxy.x86_64_1.5.18-9.el7

設定内容

/etc/haproxy/haproxy.cfg
listen redis-master
    bind 127.0.0.1:16379
    mode tcp
    option tcp-check
    tcp-check send PING\r\n
    tcp-check expect string +PONG
    server <name> <IP>:6379 check port 6379 inter 2000 fall 5

listen redis-slave
    bind 127.0.0.1:16380
    mode tcp
    option tcp-check
    tcp-check send PING\r\n
    tcp-check expect string +PONG
    server <name> <IP>:6379 check port 6379 inter 2000 fall 5

解決策

/etc/haproxy/haproxy.cfg
listen redis-master
    bind 127.0.0.1:16379
    mode tcp
    option tcp-check
    tcp-check connect #ここを追加
    tcp-check send PING\r\n
    tcp-check expect string +PONG
    server <name> <IP>:6379 check port 6379 inter 2000 fall 5

listen redis-slave
    bind 127.0.0.1:16380
    mode tcp
    option tcp-check
    tcp-check connect #ここを追加
    tcp-check send PING\r\n
    tcp-check expect string +PONG
    server <name> <IP>:6379 check port 6379 inter 2000 fall 5

haproxy.x86_64_1.5.18-9.el7 のバグのようで、 haproxy.x86_64_1.5.18-8.el7 へ戻すか
、私はtcp-check connect を追加することで解決しました。

だいぶハマった...

原因

tcp-check sendとtcp-check expectが複数行ある場合に発生するバグのようです。
tcp-check connect を追加することで新しい接続を開くことで解決できるようでした。

参考

https://access.redhat.com/solutions/4455211
https://bugzilla.redhat.com/show_bug.cgi?id=1754085
http://www.haproxy.org/download/1.5/doc/configuration.txt

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0