haproxy+pecemaker
来源:互联网 发布:电脑随机抽奖软件 编辑:程序博客网 时间:2024/05/20 22:00
haproxy+pecemaker
环境
- server4 haproxy
- server2 和 server3 apache
安装haproxy:
[root@server4 ~]# lsanaconda-ks.cfg haproxy-1.6.11.tar.gz pssh-2.3.1-2.1.x86_64.rpmcrmsh-1.2.6-0.rc2.2.1.x86_64.rpm Lvs-fullnat-synproxy.tar.gzdrbd-8.4.3.tar.gz nginx-1.12.0.tar.gz[root@server4 ~]# tar zxf haproxy-1.6.11.tar.gz [root@server4 ~]# cd haproxy-1.6.11[root@server4 haproxy-1.6.11]# lsCHANGELOG CONTRIBUTING ebtree include MAINTAINERS README src tests VERSIONcontrib doc examples LICENSE Makefile ROADMAP SUBVERS VERDATE[root@server4 haproxy-1.6.11]# cat README | grep "linux26" - linux26 for Linux 2.6 and above - linux2628 for Linux 2.6.28, 3.x, and above (enables splice and tproxy) $ make TARGET=linux26 USE_OPENSSL=1 SSL_INC=$STATICLIBSSL/include SSL_LIB=$STATICLIBSSL/lib ADDLIB=-ldl $ make TARGET=linux26 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 $ make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 $ make TARGET=linux26 ARCH=i386 USE_OPENSSL=1 ADDLIB=-lz[root@server4 haproxy-1.6.11]# uname -r2.6.32-431.el6.x86_64[root@server4 haproxy-1.6.11]# yum install gcc rpm-bulid -y [root@server4 haproxy-1.6.11]# ls examples/acl-content-sw.cfg content-sw-sample.cfg errorfiles init.haproxy stats_haproxy.shauth.cfg debug2ansi haproxy.init option-http_proxy.cfg transparent_proxy.cfgcheck debug2html haproxy.spec seamless_reload.txtcheck.conf debugfind haproxy.vim ssl.cfg[root@server4 haproxy-1.6.11]# rpmbuild -bb examples/haproxy.spec error: File /root/rpmbuild/SOURCES/haproxy-1.6.11.tar.gz: No such file or directory[root@server4 haproxy-1.6.11]# cp ~/haproxy-1.6.11.tar.gz /root/rpmbuild/SOURCES/[root@server4 haproxy-1.6.11]# rpmbuild -bb examples/haproxy.spec [root@server4 haproxy-1.6.11]# cd /root/rpmbuild/RPMS/x86_64/[root@server4 x86_64]# lshaproxy-1.6.11-1.x86_64.rpm haproxy-debuginfo-1.6.11-1.x86_64.rpm[root@server4 x86_64]# yum install haproxy-1.6.11-1.x86_64.rpm [root@server4 haproxy-1.6.11]# cd examples/[root@server4 examples]# lsacl-content-sw.cfg content-sw-sample.cfg errorfiles init.haproxy stats_haproxy.shauth.cfg debug2ansi haproxy.init option-http_proxy.cfg transparent_proxy.cfgcheck debug2html haproxy.spec seamless_reload.txtcheck.conf debugfind haproxy.vim ssl.cfg[root@server4 examples]# cp content-sw-sample.cfg /etc/haproxy/[root@server4 examples]# mv /etc/haproxy/content-sw-sample.cfg /etc/haproxy/haproxy.cfg[root@server4 examples]# vim /etc/haproxy/haproxy.cfg [root@server4[root@server4 examples]# useradd -M -s /sbin/nologin -u 600 haproxy[root@server4 examples]# id haproxyuid=600(haproxy) gid=600(haproxy) groups=600(haproxy)[root@server4 examples]# cat /etc/haproxy/haproxy.cfg | grep -v "#" global maxconn 10000 stats socket /var/run/haproxy.stat mode 600 level admin log 127.0.0.1 local0 uid 600 gid 600 chroot /var/empty daemondefaults mode http log global option httplog option dontlognull monitor-uri /monitoruri maxconn 8000 timeout client 30s retries 2 option redispatch timeout connect 5s timeout server 30s stats uri /admin/statsfrontend public bind 172.25.32.4:80 default_backend staticbackend static balance roundrobin server web1 172.25.32.2:80 check inter 1000 server web2 172.25.32.3:80 check inter 1000 weight 2[root@server4 ~]# tail -n 2 /etc/security/limits.conf # End of filehaproxy - nofile 8000[root@server4 examples]# /etc/init.d/haproxy startStarting haproxy: [ OK ]
server2 ,server3
[root@server3 ~]# /etc/init.d/httpd startStarting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 172.25.32.3 for ServerName [ OK ][root@server2 ~]# /etc/init.d/httpd startStarting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 172.25.32.2 for ServerName [ OK ]
测试:
kiosk@foundation32 Desktop]$ for i in {1..10}; do curl 172.25.32.4 ;done <h2>www.linux.org apache-server3</h2><h2>www.linux.org apache-server3</h2><h1>www.linux.org-apache-server2</h1><h2>www.linux.org apache-server3</h2><h2>www.linux.org apache-server3</h2><h1>www.linux.org-apache-server2</h1><h2>www.linux.org apache-server3</h2><h2>www.linux.org apache-server3</h2><h1>www.linux.org-apache-server2</h1><h2>www.linux.org apache-server3</h2>[kiosk@foundation32 Desktop]$ for i in {1..10}; do curl 172.25.32.4 ;done <h2>www.linux.org apache-server3</h2><h1>www.linux.org-apache-server2</h1><h2>www.linux.org apache-server3</h2><h2>www.linux.org apache-server3</h2><h1>www.linux.org-apache-server2</h1><h2>www.linux.org apache-server3</h2><h2>www.linux.org apache-server3</h2><h1>www.linux.org-apache-server2</h1><h2>www.linux.org apache-server3</h2><h2>www.linux.org apache-server3</h2>
阅读全文
0 0
- haproxy+pecemaker
- pecemaker+heartbeat高可用
- haproxy
- HAProxy
- HAProxy
- HAProxy
- haproxy
- HAPROXY
- HAProxy
- HAProxy
- HAProxy
- HAproxy
- HAProxy
- haproxy
- haproxy
- HAProxy
- HAProxy
- HAProxy
- 现实版高达!美日巨型机器人格斗大战结果即将见分晓
- 问答Goodfellow:没有样例能不能训练机器学习算法?
- 用extern声明变量
- PCA算法原理
- 网络安全攻防实验室通关教程-脚本关
- haproxy+pecemaker
- C++ 普通函数和虚函数调用的区别
- 英特尔将推Nervana神经网络处理器,要让DL训练提速100倍
- python基础-变量、数据类型、input、格式化、运算符、流程控制
- 可执行文件
- 我是如何复盘个股的
- navicate连接阿里云服务器上的mysql
- 图片轮播小圆点
- 一位资深程序员大牛给予Java初学者的学习路线建议