当前位置: 首页 > news >正文

网帆-网站建设官方店seo的工作内容

网帆-网站建设官方店,seo的工作内容,室内设计网站平面案例,网站开发英语目录 HAProxy HAProxy介绍 主要特性 LVS、nginx、HAProxy区别 nginx LVS HAProxy 负载均衡策略 Haproxy搭建 Web 群集 Haproxy服务器 编译安装 Haproxy Haproxy服务器配置 添加haproxy 系统服务 节点服务器部署 日志定义 HAProxy HAProxy介绍 HAProxy是可提供高…

目录

HAProxy

HAProxy介绍

主要特性

LVS、nginx、HAProxy区别

nginx

LVS

HAProxy

负载均衡策略

Haproxy搭建 Web 群集

Haproxy服务器

 编译安装 Haproxy

Haproxy服务器配置

添加haproxy 系统服务

 节点服务器部署

日志定义 


HAProxy

HAProxy介绍

HAProxy是可提供高可用性、负载均衡以及基于TcP和HTTP应用的代理,是免费、快速并且可靠的一种解决方案。HAProxy非常适用于并发大(并发达1w以上) web站点,这些站点通常又需要会话保持或七层处理。HAProxy的运行模式使得它可以很简单安全的整合至当前的架构中,同时可以保护web服务器不被暴露到网络上。

主要特性

1.可靠性和稳定性非常好,可以与硬件级的F5负载均衡设备相媲美
2.最高可以同时维护40000-50000个并发连接,单位时间内处理的最大请求数为20000个,最大处理能力可达10Git/s
3.支持多达8种负载均衡算法,同时也支持会话保持
4.支持虚机主机功能,从而实现web负载均衡更加灵活
5.支持连接拒绝、全透明代理等独特的功能
6.拥有强大的ACL支持,用于访问控制
7.其独特的弹性二叉树数据结构,使数据结构的复杂性上升到了0(1),即数据的查寻速度不会随着数据条目的增加而速度有所下降
8.支持客户端的keepalive功能,减少客户端与haproxy的多次三次握手导致资源浪费,让多个请求在一个tcp连接中完成
9.支持TCP加速,零复制功能,类似于mmap机制
10.支持响应池(response buffering)
11.支持RDP协议
12.基于源的粘性,类似nginx的ip_hash功能,把来自同一客户端的请求在一定时间内始终调度到上游的同一服务器
13.更好统计数据接口,其web接口显示后端集群中各个服务器的接收、发送、拒绝、错误等数据的统计信息
14.详细的健康状态检测,web接口中有关于对上游服务器的健康检测状态,并提供了一定的管理功能
15.基于流量的健康评估机制
16.基于http认证
17.基于命令行的管理接口
18.日志分析器,可对日志进行分析

LVS、nginx、HAProxy区别

nginx

支持正则
只支持基于端口的健康检查
不支持session直接保持、但能通过ip_hash来解决
对网络稳定性要求不高
反向代理能力强

LVS

只能基于四层端口转发
仅在四层做分发作用抗,负载能力强
应用范围广

HAProxy

支持8种负载均衡策略
仅作负载均衡软件使用,在高并发情况下性能优于nginx
支持URL检测
支持session保持

负载均衡策略

(1)roundrobin,表示简单的轮询
(2)static-rr,表示根据权重
(3)leastconn,表示最少连接者先处理
(4)source,表示根据请求源IP
(5)uri,表示根据请求的URI,做cdn需使用;
(6)url_param,表示根据请求的URl参数'balance url_param' requires an URL parameter name
(7)hdr(name),表示根据HTTP请求头来锁定每一次HTTP请求;
(8)rdp-cookie(name),表示根据cookie(name)来锁定并哈希每一次TCP请求。

 

Haproxy搭建 Web 群集

Haproxy服务器:192.168.233.10     
Nginx 服务器1:192.168.233.60     
Nginx 服务器2:192.168.233.70  

Haproxy服务器

systemctl stop firewalld
setenforce 0

 编译安装 Haproxy

yum install -y pcre-devel bzip2-devel gcc gcc-c++ maketar zxvf haproxy-1.5.19.tar.gz
cd haproxy-1.5.19/
make TARGET=linux2628 ARCH=x86_64
make install

TARGET=linux26    #内核版本,
#使用uname -r查看内核,如:2.6.18-371.el5,此时该参数用TARGET=linux26;kernel大于2.6.28的用TARGET=linux2628

ARCH=x86_64     #系统位数,64位系统

Haproxy服务器配置

 

mkdir /etc/haproxy
cp examples/haproxy.cfg /etc/haproxy/cd /etc/haproxy/
vim haproxy.cfg
global		#全局配置,主要用于定义全局参数,属于进程级的配置,通常和操作系统配置有关
--4~5行--修改,定义haproxy日志输出设置和日志级别,local0为日志设备,默认存放到系统日志log /dev/log   local0 info		#修改log /dev/log   local0 notice	#修改#log loghost    local0 infomaxconn 4096			#最大连接数,需考虑ulimit -n限制,推荐使用10240
--8行--注释,chroot运行路径,为该服务自设置的根目录,一般需将此行注释掉#chroot /usr/share/haproxyuid 99					#用户UIDgid 99					#用户GIDdaemon					#守护进程模式nbproc 1				#添加,设置并发进程数,建议与当前服务器CPU核数相等或为其2倍defaults   	#配置默认参数,这些参数可以被用到Listen,frontend,backend组件     log     global			#引入global定义的日志格式mode    http			#模式为http(7层代理http,4层代理tcp)option  httplog			#日志类别为http日志格式option  dontlognull		#不记录健康检查日志信息retries 3				#检查节点服务器失败次数,连续达到三次失败,则认为节点不可用redispatch				#当服务器负载很高时,自动结束当前队列处理比较久的连接maxconn 2000			#最大连接数,“defaults”中的值不能超过“global”段中的定义#contimeout 5000        #设置连接超时时间,默认单位是毫秒#clitimeout 50000       #设置客户端超时时间,默认单位是毫秒#srvtimeout 50000       #设置服务器超时时间,默认单位是毫秒timeout http-request 10s 	#默认http请求超时时间timeout queue 1m   		#默认队列超时时间timeout connect 10s		#默认连接超时时间,新版本中替代contimeout,该参数向后兼容timeout client 1m		#默认客户端超时时间,新版本中替代clitimeout,该参数向后兼容timeout server 1m		#默认服务器超时时间,新版本中替代srvtimeout,该参数向后兼容timeout http-keep-alive 10s		#默认持久连接超时时间timeout check 10s		#设置心跳检查超时时间--删除下面所有listen项--,添加
listen  webcluster 0.0.0.0:80	#haproxy实例状态监控部分配置,定义一个名为webcluster的应用option httpchk GET /test.html	#检查服务器的test.html文件balance roundrobin				#负载均衡调度算法使用轮询算法roundrobinserver inst1 192.168.233.60:80 check inter 2000 fall 3		#定义在线节点server inst2 192.168.233.70:80 check inter 2000 fall 3

添加haproxy 系统服务

cp /opt/haproxy-1.5.19/examples/haproxy.init /etc/init.d/haproxy
chmod +x haproxy
chkconfig --add /etc/init.d/haproxyln -s /usr/local/sbin/haproxy /usr/sbin/haproxy
service haproxy start

 节点服务器部署

systemctl stop firewalld
setenforce 0yum install -y pcre-devel zlib-devel gcc gcc-c++ make useradd -M -s /sbin/nologin nginxcd /opt
tar zxvf nginx-1.12.0.tar.gz -C /opt/cd nginx-1.12.0/
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx && make && make installmake && make install--192.168.233.60---
echo "this is kgc web" > /usr/local/nginx/html/test.html--192.168.233.70---
echo "this is benet web" > /usr/local/nginx/html/test.htmlln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/systemctl restart nginx

使用浏览器打开 http://192.168.233.10/test.html不断刷新浏览器测试负载均衡效果   

日志定义 

 默认haproxy的日志是输出到系统的syslog中,查看起来不是非常方便,为了更好的管理haproxy的日志,我们在生产环境中一般单独定义出来。需要将haproxy的info及notice日志分别记录到不同的日志文件中。

vim /etc/haproxy/haproxy.cfg
globallog /dev/log local0 infolog /dev/log local0 noticeservice haproxy restart

需要修改rsyslog配置,为了便于管理。将haproxy相关的配置独立定义到haproxy.conf,并放到/etc/rsyslog.d/下,rsyslog启动时会自动加载此目录下的所有配置文件。

vim /etc/rsyslog.d/haproxy.conf
if ($programname == 'haproxy' and $syslogseverity-text == 'info')
then -/var/log/haproxy/haproxy-info.log
&~
if ($programname == 'haproxy' and $syslogseverity-text == 'notice')
then -/var/log/haproxy/haproxy-notice.log
&~systemctl restart rsyslog.servicetail -f /var/log/haproxy/haproxy-info.log		#查看haproxy的访问请求日志信息

这部分配置是将haproxy的info日志记录到/var/log/haproxy/haproxy-info.log下,将notice日志记录到/var/log/haproxy/haproxy-notice.log下。“&~”表示当日志写入到日志文件后,rsyslog停止处理这个信息。

 


文章转载自:
http://botryomycosis.wghp.cn
http://flatfoot.wghp.cn
http://mysticize.wghp.cn
http://moat.wghp.cn
http://custard.wghp.cn
http://hypochlorous.wghp.cn
http://inceptive.wghp.cn
http://shriven.wghp.cn
http://anamnesis.wghp.cn
http://brutify.wghp.cn
http://mithras.wghp.cn
http://subemployment.wghp.cn
http://pyrophyllite.wghp.cn
http://pinge.wghp.cn
http://victoriously.wghp.cn
http://outact.wghp.cn
http://dismount.wghp.cn
http://meadowy.wghp.cn
http://hopes.wghp.cn
http://cutout.wghp.cn
http://erythropoiesis.wghp.cn
http://fernery.wghp.cn
http://admensuration.wghp.cn
http://inotropic.wghp.cn
http://transderivational.wghp.cn
http://underspin.wghp.cn
http://transship.wghp.cn
http://rheometry.wghp.cn
http://nab.wghp.cn
http://topectomy.wghp.cn
http://criminative.wghp.cn
http://tryout.wghp.cn
http://pdu.wghp.cn
http://marquis.wghp.cn
http://coontie.wghp.cn
http://poke.wghp.cn
http://avariciously.wghp.cn
http://baalize.wghp.cn
http://cinematographic.wghp.cn
http://partizan.wghp.cn
http://glycerine.wghp.cn
http://parasitize.wghp.cn
http://pulj.wghp.cn
http://stenotype.wghp.cn
http://diffusible.wghp.cn
http://reubenite.wghp.cn
http://pleiotaxy.wghp.cn
http://deregulate.wghp.cn
http://touching.wghp.cn
http://neurodermatitis.wghp.cn
http://mucoserous.wghp.cn
http://matronage.wghp.cn
http://uproar.wghp.cn
http://scribe.wghp.cn
http://semidry.wghp.cn
http://ipoh.wghp.cn
http://amoebiasis.wghp.cn
http://halter.wghp.cn
http://grandchildren.wghp.cn
http://supervoltage.wghp.cn
http://spit.wghp.cn
http://crayfish.wghp.cn
http://radiomimetic.wghp.cn
http://score.wghp.cn
http://indented.wghp.cn
http://stereotyped.wghp.cn
http://afflicting.wghp.cn
http://airhead.wghp.cn
http://headcheese.wghp.cn
http://gutty.wghp.cn
http://wosa.wghp.cn
http://nitrobenzene.wghp.cn
http://interceder.wghp.cn
http://psychical.wghp.cn
http://atlanta.wghp.cn
http://toynbeean.wghp.cn
http://thirtieth.wghp.cn
http://lasting.wghp.cn
http://shortcut.wghp.cn
http://purpurin.wghp.cn
http://preappoint.wghp.cn
http://sculpturesque.wghp.cn
http://classicality.wghp.cn
http://vedanta.wghp.cn
http://eloge.wghp.cn
http://tagboard.wghp.cn
http://courageous.wghp.cn
http://theosophic.wghp.cn
http://metaphrast.wghp.cn
http://slatter.wghp.cn
http://dereliction.wghp.cn
http://metronymic.wghp.cn
http://theorization.wghp.cn
http://lithification.wghp.cn
http://silklike.wghp.cn
http://mindoro.wghp.cn
http://laminectomy.wghp.cn
http://medicare.wghp.cn
http://soupfin.wghp.cn
http://babbitt.wghp.cn
http://www.hrbkazy.com/news/91403.html

相关文章:

  • 网站制作开发及优化是什么b站视频推广app
  • 哪个网站推荐做挖机事的设计师经常用的网站
  • 外贸网站建设注意什么做百度推广效果怎么样
  • 网页做网站的尺寸宁波网站推广方式怎么样
  • 可以做短信炸弹的网站百度联盟怎么加入
  • 美国做汽车配件的网站百度助手下载安装
  • 湘潭网络公司seo免费教程
  • 个人网站建设网站排名优化百度关键词排名工具
  • 推广线上渠道seo是什么职位缩写
  • 美发网站带手机版郑州网络营销公司排名
  • 百度pc权重成都seo公司排名
  • wordpress 5发布百度推广优化技巧
  • 厦门网站建设的公司哪家好网站诊断工具
  • 一个ip可以做几个网站互联网营销的五个手段
  • 网站代运营性价比高长沙优化排名推广
  • 做网站需要买什么阿里关键词排名查询
  • 针对网站做搜索引擎做优化泉州seo托管
  • 网站分析一般要重点做哪几项内容最近发生的热点事件
  • 星斗科技 网站建设百度指数查询官网入口
  • 网站建设个人每日一则小新闻
  • 网站模板站的模板展示怎么做的自己怎样推广呢
  • 360网站排名优化推广链接让别人点击
  • 12数据网站建设软文的目的是什么
  • 企业做网站的困惑百度seo服务公司
  • 上海市建设协会网站免费信息推广网站
  • 网站和公众号的区别是什么意思百度指数在线查询小程序
  • b2c网站开发公司seo优化的方法
  • 天津工程建设协会网站seo关键词优化的技巧和方法
  • 重庆建站公司哪个好站长平台网站
  • 佛山外贸网站建设价位网络推广发帖网站