더북(TheBook)

5. 두 노드의 Keepalived 설정이 완료되면 HAProxy가 설치된 ubuntu01, ubuntu02, ubuntu03 서버의 /etc/haproxy/haproxy.cfg 파일을 엽니다. galera_cluster의 127.0.0.1로 되어 있는 bind를 keepalived.conf 파일에서 설정한 virtual_ipaddress로 변경합니다. 여기서는 가상 IP가 192.168.56.200이므로 해당 IP로 설정했습니다.

root@ubuntu01:~# vi /etc/haproxy/haproxy.cfg
global
  log      127.0.0.1 local2 info
  chroot   /var/lib/haproxy
  pidfile  /var/run/haproxy.pid
  maxconn  4000
  group    haproxy
  user     haproxy
  daemon

defaults log global maxconn 4000 option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout check 10s

listen galera_cluster bind 192.168.56.200:33006 balance source option mysql-check server ubuntu01 192.168.56.102:3306 check port 9200 inter 2000 rise 2 fall 5 server ubuntu02 192.168.56.103:3306 backup check port 9200 inter 2000 rise 2 fall 5 server ubuntu03 192.168.56.104:3306 backup check port 9200 inter 2000 rise 2 fall 5

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.