tar -zxvf haproxy-1.8.20.tar.gz
cd haproxy-1.8.20
make TARGET=linux2628 ARCH=x86_64 PREFIX=/usr/local/haproxy
make install PREFIX=/usr/local/haproxy1
2
3
4
5参数说明
TARGET=linux26 #内核版本,使用uname -r查看内核,如:2.6.18-371.el5,此时该参数就为linux26;kernel 大于2.6.28的
用:TARGET=linux2628
ARCH=x86_64 #系统位数
PREFIX=/usr/local/haprpxy #/usr/local/haprpxy为haprpxy安装路径
cd /usr/local/haprpxy1
2# ls
doc sbin share
mkdir conf
vim conf/haproxy.cfg
1 | ###########全局配置######### |
启动haproxy
sbin/haproxy -f conf/haproxy.cfg
配置日志
https://blog.51cto.com/zhangshijie/1742746
https://www.cnblogs.com/saneri/p/5234101.html
vim /etc/rsyslog.conf1
2
3
4
5
613 $ModLoad imudp #将13行注释去除
14 $UDPServerRun 514 #将14行注释去除
#最下方添加
local3.* /var/log/haproxy.log
local0.* /var/log/haproxy.log
重启
/etc/init.d/rsyslog restart
在master 上创建用户,并授权1
2
3use mysql;
create user 'dev'@'192.168.159.%' identified by 'p4ssword';
grant all on *.* to dev@'192.168.159.%' identified by 'p4ssword';
访问测试
mysql -h 192.168.159.102 -udev -pp4ssword -P6033 -e “show variables like ‘server_id’”