How haproxy proxies hive
This article mainly introduces how haproxy acts as hive, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
Global
Daemon
Nbproc 1
Pidfile / var/run/haproxy.pid
Ulimit-n 65535
Defaults
Mode tcp # mode {tcp | http | health}, tcp represents layer 4, http represents layer 7, and health is only used for health check
Retries 2 # is removed from the cluster if it fails 2 times.
Option redispatch # forcibly convert other servers if it fails
Option abortonclose # automatically shuts down if the number of connections is too large
Maxconn 1024 # maximum connections
Timeout connect 1d # connection timeout, important, guarantee that hive query data can return results
Timeout client 1D # ditto
Timeout server 1D # ditto
Timeout check 2000 # Health check time
Log 127.0.0.1 local0 err # [err warning info debug]
Listen admin_stats # defines the management interface
Bind 0.0.0.0 1090 # Administrative Interface accesses IP and Port
Protocols used by the mode http # management interface
Maxconn 10 # maximum number of connections
Stats refresh 30s # 30 seconds automatic refresh
Stats uri / # visit url
Stats realm Hive\ Haproxy # Verification window prompt
Stats auth admin:123456 # 401 verify username and password
Listen hive # hive backend definition
Bind 0.0.0.0 IP and port bound by proxy 10001 # ha
Mode tcp # proxies in a 4-tier manner, important
Balance leastconn # scheduling algorithm 'leastconn' minimum connection allocation, or' roundrobin', polling allocation
Maxconn 1024 # maximum connections
Server hive_1 192.168.1.1:10000 check inter 180000 rise 1 fall 2
Server hive_2 192.168.1.2:10000 check inter 180000 rise 1 fall 2
# interpretation: server host name (as long as you can read it yourself), IP: the port is checked every 180000 milliseconds. That's three minutes.
# hive creates a log for every request with port 10000. If the setting is too short, there will be countless log files under / tmp, which cannot be deleted.
Haproxy-f conf.cfg
Thank you for reading this article carefully. I hope the article "haproxy how to represent hive" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!