4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HAPROXY構築

Last updated at Posted at 2017-02-06

MySQL GROUP REPLICATION用HAPROXY設定
Ubuntu16.04を想定
HAPROXY1.5までは起動時の名前解決を持ち続けて再起動するまで更新できないので注意

#インストール
sudo apt-get install haproxy
sudo vi /etc/haproxy/haproxy.cfg

frontend mysql-gr-front_write
bind *:13306
mode tcp
default_backend mysql-gr-back_write

backend mysql-gr-back_write
mode tcp
balance leastconn
option httpchk
server mysql1 xxx.xxx.xxx.xxx:3306 check port 6446 inter 1000 rise 1 fall 2 on-marked-up shutdown-backup-sessions
server mysql2 xxx.xxx.xxx.xxx:3306 check port 6446 inter 1000 rise 1 fall 2 backup

frontend mysql-gr-front_read
bind *:23306
mode tcp
default_backend mysql-gr-back_read

backend mysql-gr-back_read
mode tcp
balance leastconn
option httpchk
server mysql1 xxx.xxx.xxx.xxx:3306 check port 6447 inter 1000 rise 1 fall 2
server mysql2 xxx.xxx.xxx.xxx:3306 check port 6447 inter 1000 rise 1 fall 2

listen  stats
        bind 0.0.0.0:1936
        mode http
        maxconn 10
        stats enable
        stats hide-version
        stats refresh 30s
        stats show-node
        #stats auth admin:password
        stats uri /

sudo /etc/init.d/haproxy start

#起動
sudo netstat -natp | grep haproxy
ログが出力されるようrsyslogの再起動
sudo /etc/init.d/rsyslog restart

#状態監視
http://xxx.xxxx.xxx.xxx:1936/

4
4
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
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?