Skip to content

Instantly share code, notes, and snippets.

@shyazusa
Created November 16, 2017 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shyazusa/7ed1430b537f48a1b4aae6a62d948613 to your computer and use it in GitHub Desktop.
Save shyazusa/7ed1430b537f48a1b4aae6a62d948613 to your computer and use it in GitHub Desktop.
HAProxyのコンフィグファイルの一例です。
# Global
global
daemon
# Defaults
defaults
mode tcp
timeout connect 5s
timeout client 10s
timeout server 10s
retries 2
# REDIS
frontend redis
bind *:6379
default_backend redis_backend
backend redis_backend
option tcp-check
tcp-check connect
tcp-check send PING\r\n
tcp-check expect string +PONG
tcp-check send info\ replication\r\n
tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server redis1 127.0.0.1:6380 check inter 1s
server redis2 127.0.0.1:6381 check inter 1s
# Elasticsearch
frontend elasticsearch
bind *:9200
default_backend elasticsearch_backend
backend elasticsearch_backend
balance first
option redispatch
retries 2
server elasticsearch1 127.0.0.1:9201 check inter 1s
server elasticsearch2 127.0.0.1:9202 check inter 1s
server elasticsearch3 127.0.0.1:9203 check inter 1s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment