sudo yum install haproxy
257 yun -ql haproxy
258 rpm -ql haproxy
259 cat /share/doc/haproxy-1.5.18/haproxy.cfg
260 cat /usr//share/doc/haproxy-1.5.18/haproxy.cfg
261 top
262 mkdir /usr/local/haproxy/logs
263 sudo mkdir -p /usr/local/haproxy/logs
264 ls
265 haproxy -f /home/spark/haproxy/config.cfg
266 ls
267 top
268 haproxy -f /home/spark/haproxy/config.cfg
269 sudo /home/spark/haproxy/config.cfg
270 sudo haproxy -f /home/spark/haproxy/config.cfg
271 ld
272 ls
273 sudo haproxy stop
274 ps -ef |grep haproxy
275 sudo kill -9 137099
276 sudo haproxy -f /home/spark/haproxy/config.cfg
config.cfg
[spark@zk50 ~]$ cat /home/spark/haproxy/config.cfg
global
daemon
nbproc 1
pidfile /usr/local/haproxy/logs/haproxy.pid
ulimit-n 65535
defaults
mode tcp #mode { tcp|http|health },tcp 表示4层,http表示7层,health仅作为健康检查使用
retries 2 #尝试2次失败则从集群摘除
option redispatch #如果失效则强制转换其他服务器
option abortonclose #连接数过大自动关闭
maxconn 30 #最大连接数
timeout connect 20s #连接超时时间,重要,hive查询数据能返回结果的保证
timeout client 20s #同上
timeout server 20s #同上
timeout check 2000 #健康检查时间
log 127.0.0.1 local0 err #[err warning info debug]
listen admin_stats #定义管理界面
bind 192.168.221.50:9999 #管理界面访问IP和端口
mode http #管理界面所使用的协议
maxconn 20 #最大连接数
stats refresh 30s #30秒自动刷新
stats uri / #访问url
stats realm Hive\ Haproxy #验证窗口提示
stats auth dc:dc #401验证用户名密码
listen hive #hive后端定义
bind 192.168.221.50:10000 #ha作为proxy所绑定的IP和端口
mode tcp #以4层方式代理,重要
balance leastconn #调度算法 'leastconn' 最少连接数分配,或者 'roundrobin',轮询分配
maxconn 20 #最大连接数
server hive_1 192.168.221.50:9994 check inter 10000 rise 1 fall 2
server hive_2 192.168.221.50:9995 check inter 10000 rise 1 fall 2
server hive_3 192.168.221.50:9996 check inter 10000 rise 1 fall 2
server hive_4 192.168.221.50:9997 check inter 10000 rise 1 fall 2
#释义:server 主机代名(你自己能看懂就行),IP:端口 每180000毫秒检查一次。也就是三分钟。
#hive每有10000端口的请求就会创建一个log,设置短了,/tmp下面会有无数个log文件,删不完。
thriftServer proxy
猜你喜欢
转载自lingzhi007.iteye.com/blog/2396462
今日推荐
周排行