오늘만살자

haproxy mqtt 본문

Linux/Centos

haproxy mqtt

오늘만살자 2020. 4. 23. 13:48

 

#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   https://www.haproxy.org/download/1.8/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    # to have these messages end up in /var/log/haproxy.log you will
    # need to:
    #
    # 1) configure syslog to accept network log events.  This is done
    #    by adding the '-r' option to the SYSLOGD_OPTIONS in
    #    /etc/sysconfig/syslog
    #
    # 2) configure local2 events to go to the /var/log/haproxy.log
    #   file. A line like the following can be added to
    #   /etc/sysconfig/syslog
    #
    #    local2.*                       /var/log/haproxy.log
    #
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

    # utilize system-wide crypto-policies
    ssl-default-bind-ciphers PROFILE=SYSTEM
    ssl-default-server-ciphers PROFILE=SYSTEM

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  tcplog
    option                  dontlognull
    option http-server-close
    #option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 30000

listen stats # "stats"라는 이름으로 listen 지정
    bind :9009 # 접속 포트 지정
    stats enable
    stats realm Haproxy\ Statistics  # 브라우저 타이틀
    stats uri /haproxy_stats  # stat 를 제공할 URI
    stats auth admin:admin1234 # 인증이 필요하면 추가한다

#listen mqtt-in
#    balance leastconn
#    bind *:1883
    #default_backend mqtt_backend
#    mode tcp
#    log global
#    option tcplog
#    option clitcpka # For TCP keep-alive
#    timeout client 3h #By default TCP keep-alive interval is 2hours in OS kernal, 'cat /proc/sys/net/ipv4/tcp_keepalive_time'
#    timeout server 3h #By default TCP keep-alive interval is 2hours in OS kernal
#    server master  172.16.135.123:1883 check
#    server work01  172.16.135.123:1884 check
#    server work02  172.16.135.123:1885 check


frontend emqx_tcp
    bind *:1883
    option tcplog
    option clitcpka # For TCP keep-alive
    #timeout client 3h #By default TCP keep-alive interval is 2hours in OS kernal, 'cat /proc/sys/net/ipv4/tcp_keepalive_time'
    #timeout server 3h #By default TCP keep-alive interval is 2hours in OS kernal
    mode tcp
    default_backend backend_emqx_tcp

backend backend_emqx_tcp
    balance roundrobin
    server master  172.16.135.123:1883 check
    server work01  172.16.135.123:1884 check
    server work02  172.16.135.123:1885 check

frontend emqx_websocket
    bind *:8083
    default_backend backend_emqx_websocket

backend backend_emqx_websocket
    mode http
    balance roundrobin
    server master  172.16.135.123:8083 check
    server work01  172.16.135.123:8084 check
    server work02  172.16.135.123:8085 check

frontend emqx_dashboard
    bind *:18083
    default_backend backend_emqx_dashboard

backend backend_emqx_dashboard
    mode http
    balance roundrobin
    server master 172.16.135.123:18083 check
    server work01 172.16.135.123:18084 check
    server work02 172.16.135.123:18085 check

'Linux > Centos' 카테고리의 다른 글

centos8 Failed to set locale, defaulting to C.UTF-8  (0) 2020.04.29
CentOS 8 docker install  (0) 2020.04.28
centos8 virtualbox  (0) 2020.04.28
centos8 ntp sever  (0) 2020.04.23
Haproxy cannot bind socket error  (0) 2020.04.22
Comments