server-side/haproxy

HAProxy MySQL replication, cluster

C/H 2017. 5. 10. 18:34

/etc/haproxy/haproxy.cfg

global
	log		 127.0.0.1 local0 info
	log		 127.0.0.1 local1 notice
	#chroot	 /var/lib/haproxy
	#pidfile		/var/run/haproxy.pid
	maxconn	 80000		   # 최대 동시접속 설정, 1GM 40,000 ~ 50,000
	#user	   haproxy
	#group	  haproxy
	tune.bufsize	65536
	tune.ssl.default-dh-param   2048
	#nbproc	 4			   # 실행 프로세스 수
	daemon					  # daemon 모드실행(권장)
	# turn on stats unix socket
	stats socket /var/lib/haproxy/stats

defaults
	log global
	option tcplog
	retries 2
	timeout connect 3000
	timeout server 5000
	timeout client 5000

listen mysql-read
	bind :3306
	mode tcp
	balance roundrobin
	option mysql-check user haproxy_check
	server mysql1 x.x.x.x:3306 check
	server mysql2 x.x.x.x:3306 check
	server mysql3 x.x.x.x:3306 check

mysql health check user

use mysql;
#insert into user (Host, User) values ('%', 'haproxy_check');
insert into user (Host, User) values ('haproxyServerIP', 'haproxy_check');
flush privileges;
# haproxy server
yum install mysql
# connect check
mysql -h"haproxyServerIP" -u haproxy_check -p -e "show variables like 'pid_file'"
mysql -h 127.0.0.1 -u haproxy_check -p -e "show variables like 'server_id'"

init script - unary operator expected

# . /etc/rc.d/init.d/haproxy: line 26: [: =: unary operator expected
#[ ${NETWORKING} = "no" ] && exit 1
[ "${NETWORKING}"" = "no" ] && exit 1


반응형

'server-side > haproxy' 카테고리의 다른 글

haproxy log setup  (0) 2017.06.09
HAProxy Mysql 'Reading initial communication packet'  (0) 2017.05.12
HAProxy COMODO Wildcard SSL  (0) 2017.05.08
HAProxy Stats Scoket Path Error  (0) 2017.05.02
HAProxy Multi Process Warning  (0) 2017.05.01