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

线框图网站台州关键词优化平台

线框图网站,台州关键词优化平台,服务好的徐州网站建设,中天建设第四网站haproxy具有高性能、高可用性、灵活的负载均衡策略和强大的将恐和日志功能,是法国开发者 威利塔罗(Willy Tarreau)在2000年使用C语言开发的一个开源软件,是一款具 备高并发(一万以上)、高性能的TCP和HTTP负载均衡器,支持基于cookie的持久性&a…

haproxy具有高性能、高可用性、灵活的负载均衡策略和强大的将恐和日志功能,是法国开发者 威利塔罗(Willy Tarreau)在2000年使用C语言开发的一个开源软件,是一款具 备高并发(一万以上)、高性能的TCP和HTTP负载均衡器,支持基于cookie的持久性,自动故障切换,支 持正则表达式及web状态统计。

这里对安装社区免费的版本进行介绍(3.1):Index of /download/3.1/src

wget https://www.haproxy.org/download/3.1/src/haproxy-3.1.3.tar.gz

解压到/etc/local/src

tar -zxvf haproxy-3.1.3.tar.gz -C /usr/local/src/[root@localhost ~]# ll /usr/local/src/
total 4
drwxrwxr-x. 13 root root 4096 Jan 29 21:20 haproxy-3.1.3

 我们可以在安装好的这个目录中找到INSTALL这个文件,more INSTALL,这里提供的是官方文档,我们找到Build environment,这里提到了编译环境的要求几个软件包的版本,比如:


HAProxy requires a working GCC or Clang toolchain and GNU make :

  - GNU make >= 3.80. Note that neither Solaris nor OpenBSD's make work with
    the GNU Makefile. If you get many syntax errors when running "make", you
    may want to retry with "gmake" which is the name commonly used for GNU make
    on BSD systems.

  - GCC >= 4.2 (up to 14 tested). Older versions can be made to work with a
    few minor adaptations if really needed. Newer versions may sometimes break
    due to compiler regressions or behaviour changes. The version shipped with
    your operating system is very likely to work with no trouble. Clang >= 3.0
    is also known to work as an alternative solution. Recent versions may emit
    a bit more warnings that are worth reporting as they may reveal real bugs.
    TCC (https://repo.or.cz/tinycc.git) is also usable for developers but will
    not support threading and was found at least once to produce bad code in
    some rare corner cases (since fixed). But it builds extremely quickly
    (typically half a second for the whole project) and is very convenient to
    run quick tests during API changes or code refactoring.

  - GNU ld (binutils package), with no particular version. Other linkers might
    work but were not tested.

我们检查一下自己的安装的make和gcc版本

[root@localhost haproxy-3.1.3]# yum list make
Installed Packages
make.x86_64                           1:4.2.1-11.el8
[root@localhost haproxy-3.1.3]# yum list gcc
Installed Packages
gcc.x86_64                         8.5.0-23.el8_10                          @appstream

可以看到是满足上述要求的,未安装的话可以yum安装,这里还建议安装openssl-devel(haproxy加密通信),pcre-devel(正则请求匹配和处理),systemd-devel(使用systemd管理 haproxy)这几个软件,提供额外的功能支持:yum install openssl-devel pcre-devel systemd-devel -y

haproxy是对lua是有要求的,比如以下信息说明至少要大于等于5.3,这在编译haproxy时应该是需要的,我们要指定USE_LUA=1,然后在默认情况下haproxy会寻找lua5.4,lua54,lua5.3这种名字,找不到的话可能会报错,所有这里在编译的时候官方也建议使用变量'LUA_LIN_NAME'。如果读者的系统为CentOS7 之前版本自带的lua版本比较低并不符合HAProxy要求的lua最低版本(5.3)的要求,因此需要编译安装较新版本的lua环境,然后才能编译安装HAProxy

查看本地默认lua版本信息

[root@localhost haproxy-3.1.3]# yum list lua
Available Packages
lua.x86_64                           5.3.4-12.el8                            appstream

 可以yum直接安装,或者源码安装,这里我选择源码安装5.4版本的。官网地址:Lua: download

我们下载下来之后,根据上图haproxy的提示的extracted and built步骤或者lua官网提示步骤,进行操作

tar -zxvf lua-5.4.7.tar.gz -C /opt/
ll /opt
#total 0
#drwxr-xr-x. 4 1026 1000 58 Jun 14  2024 lua-5.4.7
cd /opt/lua-5.4.7/
make all test
#-------------------------------------------------
sed -n '/lua-5.4.6/ p' /usr/local/src/haproxy-3.1.3/INSTALL$ cd /opt/lua-5.4.6USE_LUA=1 LUA_INC=/opt/lua-5.4.6/src LUA_LIB=/opt/lua-5.4.6/srccd /usr/local/src/haproxy-3.1.3/
编译
make  ARCH=x86_64 TARGET=linux-glibc  USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1  USE_SYSTEMD=1  USE_LUA=1 LUA_INC=/opt/lua-5.4.7/src LUA_LIB=/opt/lua-5.4.7/src
#上面将我们之前安装的软件对应的服务打开,在编译的时候使用变量名=1
安装
make -p /app/haproxy
make install PREFIX=/apps/haproxy
[root@localhost haproxy]# tree
.
├── doc
│   └── haproxy
│       ├── 51Degrees-device-detection.txt
│       ├── configuration.txt
│       ├── cookie-options.txt
│       ├── DeviceAtlas-device-detection.txt
│       ├── intro.txt
│       ├── linux-syn-cookies.txt
│       ├── lua.txt
│       ├── management.txt
│       ├── netscaler-client-ip-insertion-protocol.txt
│       ├── network-namespaces.txt
│       ├── peers.txt
│       ├── peers-v2.0.txt
│       ├── proxy-protocol.txt
│       ├── regression-testing.txt
│       ├── seamless_reload.txt
│       ├── SOCKS4.protocol.txt
│       ├── SPOE.txt
│       └── WURFL-device-detection.txt
├── sbin
│   └── haproxy
└── share└── man└── man1└── haproxy.1

 最后添加到环境变量或在创建软连接

ln -s /app/haproxy/sbin/haproxy /usr/sbin/

验证是否安装成功:

[root@localhost ~]# haproxy -v
HAProxy version 3.1.3-929bedf 2025/01/29 - https://haproxy.org/
Status: stable branch - will stop receiving fixes around Q1 2026.
Known bugs: http://www.haproxy.org/bugs/bugs-3.1.3.html
Running on: Linux 4.18.0-553.el8_10.x86_64 #1 SMP Fri May 24 13:05:10 UTC 2024 x86_64

 安装就正式完成了,但是启动还需要一定的配置,我们现在还需要配置一下pid文件和系统配置文件让它能够通过systemctl启动,然后再配置下haproxy的配置文件

首先先创建pid的目录,这个目录应该是haproxy可以读写的,所以这里需要创建一个用户haproxy,它的家目录就是pid文件所在目录。

mkdri /var/lib/haproxy
useradd -r -s /sbin/nologin -d /var/lib/haproxy haproxy#-r表示系统用户-s用于设置登录权限-d指定家目录

 haproxy的配置文件

make /etc/haproxy
vim /etc/haproxy/haproxy.cfg
globalmaxconn 100000chroot /app/haproxystats socket /var/lib/haproxy/haproxy.sock mode 600 level adminuser  haproxygroup haproxydaemonpidfile /var/lib/haproxy/haproxy.pidlog 127.0.0.1 local2 info
defaultsoption http-keep-aliveoption  forwardformaxconn 100000mode httptimeout connect 300000mstimeout client  300000mstimeout server  300000ms
listen statsmode httpbind 0.0.0.0:9999#监听端口设置为9999stats enablelog globalstats uri    /haproxy#后面用于登录的路由stats auth   haproxy:123456#用户和密码

 上面这个配置内容是参考官方给的示例设置的:比如下面的都是参考内容

[root@localhost haproxy]# tree /usr/local/src/haproxy-3.1.3/examples/
/usr/local/src/haproxy-3.1.3/examples/
├── basic-config-edge.cfg
├── content-sw-sample.cfg
├── errorfiles
│   ├── 400.http
│   ├── 403.http
│   ├── 408.http
│   ├── 500.http
│   ├── 502.http
│   ├── 503.http
│   ├── 504.http
│   └── README
├── haproxy.init
├── lua
│   ├── event_handler.lua
│   ├── mailers.lua
│   └── README
├── mptcp-backend.py
├── mptcp.cfg
├── option-http_proxy.cfg
├── quick-test.cfg
├── socks4.cfg
├── traces.cfg
├── transparent_proxy.cfg
└── wurfl-example.cfg

创建系统启动haproxy的配置文件:vim /usr/lib/systemd/system/haproxy.service

[Unit]Description=HAProxy Load BalancerAfter=syslog.target network.target[Service]ExecStartPre=/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg  -c -qExecStart=/usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /var/lib/haproxy/haproxy.pidExecReload=/bin/kill -USR2 $MAINPID[Install]WantedBy=multi-user.target

 重新加载一下守护进程:systemctl daemon-reload

systemctl start haproxy
systemctl status haproxy

 关闭防火墙和selinux之后进入192.168.118.130:9999/haproxy

输入配置文件中的设置的用户和密码,即可完成登录:


文章转载自:
http://timekeeper.pfbx.cn
http://holdout.pfbx.cn
http://autocriticism.pfbx.cn
http://sigurd.pfbx.cn
http://bright.pfbx.cn
http://billiardist.pfbx.cn
http://changeroom.pfbx.cn
http://gimel.pfbx.cn
http://ablegate.pfbx.cn
http://philae.pfbx.cn
http://palimpsest.pfbx.cn
http://jasmin.pfbx.cn
http://trank.pfbx.cn
http://transgenosis.pfbx.cn
http://derry.pfbx.cn
http://velveret.pfbx.cn
http://hydroscopicity.pfbx.cn
http://lankly.pfbx.cn
http://prognosticator.pfbx.cn
http://waterskin.pfbx.cn
http://sanctimony.pfbx.cn
http://surfperch.pfbx.cn
http://falling.pfbx.cn
http://eumenides.pfbx.cn
http://dingbat.pfbx.cn
http://retread.pfbx.cn
http://speedily.pfbx.cn
http://consecrated.pfbx.cn
http://contemptible.pfbx.cn
http://midianite.pfbx.cn
http://antimonous.pfbx.cn
http://diphtheroid.pfbx.cn
http://copenhagen.pfbx.cn
http://hedgerow.pfbx.cn
http://coact.pfbx.cn
http://benthos.pfbx.cn
http://agitated.pfbx.cn
http://internetwork.pfbx.cn
http://ratemeter.pfbx.cn
http://dyscrasite.pfbx.cn
http://verbiage.pfbx.cn
http://habiliment.pfbx.cn
http://hypothermal.pfbx.cn
http://docudrama.pfbx.cn
http://saveable.pfbx.cn
http://scattergraph.pfbx.cn
http://rental.pfbx.cn
http://godmother.pfbx.cn
http://preventible.pfbx.cn
http://backtrack.pfbx.cn
http://congressite.pfbx.cn
http://pendulous.pfbx.cn
http://asceticism.pfbx.cn
http://nubecula.pfbx.cn
http://upton.pfbx.cn
http://muscatel.pfbx.cn
http://micrococcal.pfbx.cn
http://strongylid.pfbx.cn
http://semiliteracy.pfbx.cn
http://leprechaun.pfbx.cn
http://retardee.pfbx.cn
http://highroad.pfbx.cn
http://optic.pfbx.cn
http://vestlike.pfbx.cn
http://taillight.pfbx.cn
http://zooecium.pfbx.cn
http://carbonylic.pfbx.cn
http://categorise.pfbx.cn
http://immunogenic.pfbx.cn
http://ameliorator.pfbx.cn
http://rakehelly.pfbx.cn
http://auspicial.pfbx.cn
http://obvious.pfbx.cn
http://featherlight.pfbx.cn
http://fashionable.pfbx.cn
http://shopwindow.pfbx.cn
http://hummum.pfbx.cn
http://mishmash.pfbx.cn
http://pungi.pfbx.cn
http://defiance.pfbx.cn
http://beggar.pfbx.cn
http://qktp.pfbx.cn
http://laager.pfbx.cn
http://stroll.pfbx.cn
http://bindery.pfbx.cn
http://louden.pfbx.cn
http://campari.pfbx.cn
http://cartridge.pfbx.cn
http://faithless.pfbx.cn
http://getatable.pfbx.cn
http://thruput.pfbx.cn
http://mamillate.pfbx.cn
http://asinine.pfbx.cn
http://griffin.pfbx.cn
http://heated.pfbx.cn
http://caph.pfbx.cn
http://facing.pfbx.cn
http://equinoctial.pfbx.cn
http://vav.pfbx.cn
http://senile.pfbx.cn
http://www.15wanjia.com/news/81400.html

相关文章:

  • 怎么样才算大型网站开发搜索引擎优化关键词的处理
  • 做网站 会计分录免费涨1000粉丝网站
  • 百度云服务器建设网站无锡百度
  • iis5 新建网站合肥网站推广公司排名
  • node新闻网站开发的意义seo关键词首页排名
  • 个人简介网站html代码a5站长网
  • 软件测试招聘seo教程排名第一
  • 校园微网站建设自动点击器
  • 聊城做网站费用信息公众号如何推广引流
  • 河南建设网站官网品牌线上推广方式
  • 深圳做网站推荐哪家公司常州网络推广平台
  • 珠海商城网站制作自己可以创建网站吗
  • 手机版电脑qq登录入口连云港网站seo
  • 网站地图有什么作用百度搜索名字排名优化
  • 网络营销指导如何做百度关键词搜索引擎排名优化
  • 长春作网站网络推广页面
  • 为企业做网站的公司神马推广登录
  • 北京做兼职的网站百度推广优化师是什么
  • 网站建设公司彩铃网络营销型网站
  • 顺义企业建站如何刷seo关键词排名
  • 做旅行义工网站蚁网站怎么优化自己免费
  • 淘宝联盟里的网站推广怎么做首页关键词怎么排名靠前
  • 网站建设开发网站案例项目费用seo推广宣传
  • wordpress网站类型seo入门培训教程
  • 专业做医院网站建设外贸谷歌推广
  • 龙岗外贸网站建设公司价格百度问问首页登录
  • 龙口建设网站seo关键词优化怎么做
  • 天津市网站建设公司腾讯企点qq
  • 商城网站怎么做推广seo收费
  • 长春网站优化教程成人教育培训机构十大排名