In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Haproxy reverse proxy
The role of haproxy: reverse proxy server. When a public network user accesses the web server, the haproxy server specifies and hands it over to that web server to achieve high availability and load balancing of the cluster.
Case implementation steps:
V compile and install niginx server
# yum-y install pcre-devel zlib-devel
# useradd-M-s / sbin/nologin nginx
# tar xzvf nginx-1.6.0.tar.gz
# cd nginx-1.6.0
#. / configure-prefix=/usr/local/nginx-user=nginx-group=nginx-with-http_stub_status_module
# make & & make install
# ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin
# nginx
# netstat-lnupt | grep: 80
# echo 1111 > / usr/local/nginx/html/index.html
V compile and install haproxy server
# yum-y install pcre-devel bzip2-devel
# tar xzvf haproxy-1.4.24.tar.gz
# cd haproxy-1.4.24
# make TARGET=linux26 PREFIX=/usr/local/haproxy
# make install PREFIX=/usr/local/haproxy
# cp examples/haproxy.cfg / etc
V restart the service
# / usr/local/haproxy/sbin/haproxy-f / etc/haproxy.cfg
V Haproxy server configuration
# vim / etc/haproxy.cfg
Modify the content:
Global
Log 127.0.0.1 local0 configures logging, and local0 is a logging device
Log127.0.0.1 local1 notice notice is a log level, which usually has 24 levels
# log loghostlocal10 info
Maxconn 4096 maximum number of connections
Uid 99 user uid
Gid 99 user gid
Daemon user
# debug
# quiet
Defaults
Log global defines logs as logs in the global configuration
Modehttp mode is http
Option httplog records logs in http log format
Option dontlognull
Retries 3 check number of node server failures
Maxconn 2000 maximum number of connections
Contimeout 5000 connection timeout
Clitimeout 50000 client timeout
Srvtimeout 50000 server timeout
Listen webcluster 0.0.0.0 80 defines an application
Option httpchk GET / index.html checks the server's index.html file
Balance roundrobin load balancing scheduling algorithm using polling algorithm rr
Server inst1 1.1.1.1 fall 80 check inter 2000 fall 3 defines an online node
Server inst2 1.1.1.2 fall 80 check inter 2000 backup 3 defines a backup node
V haproxy log custom location
# vim / etc/haproxy.cfg
Modify the content:
Log / dev/log local0 info
Log / dev/log local0 notice
# touch / etc/rsyslog.d/haproxy.conf
# vim / etc/rsyslog.d/haproxy.conf
Add content:
If ($programname = = 'haproxy' and $syslogserverity-text = =' info') then-/ var/log/haproxy/haproxy-info.log & ~
If ($programname = = 'haproxy' and $syslogserverity-text = =' notice') then-/ var/log/haproxy/haproxy-notice.log & ~
# / usr/local/haproxy/sbin/haproxy-f / etc/haproxy.cfg
Note: the log of haproxy is output to syslog of the system by default.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.