- 1、本文档共22页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
基于一般的调度器设置(有listen,但无frontend和backend)
项目1:haproxy机器部署web集群(httpd是虚拟主机情况,只检查IP端口,不检查域名和站点网页)
haproxy机器:(双网卡:eth0:eth1:)(不用配hosts解析,客户端能自动按照域名识别)
[root@localhost桌面]#ifconfigeth0|head-2
eth0Linkencap:EthernetHWaddr00:0C:29:90:BC:2C
inetaddr:Bcast:55Mask:
[root@localhost桌面]#ifconfigeth1|head-2
eth1Linkencap:EthernetHWaddr00:0C:29:90:BC:36
inetaddr:Bcast:55Mask:
[root@localhost桌面]#vim/etc/sysctl.conf//也可不开路由转发,养成习惯最好
net.ipv4.ip_forward=1
wq
[root@localhost桌面]#sysctl-p
[root@localhost桌面]#yum-yinstallgccgcc-c++
[root@localhost桌面]#ls
haproxy-1.4.24.tar.gz
[root@localhost桌面]#tar-zxfhaproxy-1.4.24.tar.gz
[root@localhost桌面]#ls
haproxy-1.4.24haproxy-1.4.24.tar.gz
[root@localhost桌面]#cdhaproxy-1.4.24
[root@localhosthaproxy-1.4.24]#ls
CHANGELOGebtreeLICENSEMakefile.osxsrcTODO
contribexamplesMakefileREADMESUBVERSVERDATE
docincludeMakefile.bsdROADMAPtestsVERSION
[root@localhosthaproxy-1.4.24]#makeTARGET=linux2628ARCH=x86_64//编译,target指定内核,架构选择
[root@localhosthaproxy-1.4.24]#makePREFIX=/usr/local/haproxyinstall
[root@localhosthaproxy-1.4.24]#cd/usr/local/haproxy/
[root@localhosthaproxy]#ls
docsbinshare
[root@localhosthaproxy]#mkdirconflogsvar/runvar/chroot-p //优化目录结构,也可不做,根据需要
[root@localhosthaproxy]#ls
confdoclogssbinsharevar
安装后链接变量路径和cp配置文件和启动脚本:
[root@localhosthaproxy]#ln-s/usr/local/haproxy/sbin/haproxy/usr/sbin/
[root@localhosthaproxy]#mkdir/etc/haproxy
[root@localhosthaproxy]#cp/root/桌面/haproxy-1.4.24/examples/haproxy.cfg/etc/haproxy/
[root@localhosthaproxy]#cp/root/桌面/haproxy-1.4.24/examples/haproxy.init/etc/init.d/haproxy
[root@localhosthaproxy]#chmod+x/etc/init.d/haproxy
[root@localhosthaproxy]#/etc/init.d/haproxystart//第一次启动会报错,配置文件模板需改
[root@localhosthaproxy]#vim/etc/haproxy/haproxy.cfg//只检查IP端口,不检查域名和站点网页
global
- shijianqiang + 关注
-
实名认证内容提供者
高级 Linux 运维工程师持证人
工作以来一直奋斗在运维的前线,对整个运维流程有比较详细的了解、各类服务的部署维护、常用中间件、数据库、排查故障、监控报警、容器和k8s方面有较强的项目实战经验。
文档评论(0)