In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Prepare the yum feed
Cd / etc/yum.repos.d/
Rm-rf *
Wget http://mirrors.aliyun.com/repo/Centos-7.repo
Wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
Wget http://mirrors.aliyun.com/repo/epel-7.repo
Yum repolist
Configure keepalived
Yum-y install keepalived
Vim / etc/keepalived/keepalived.conf
Vrrp_instance VI_1 {
State MASTER # the other server is SLAVE
Interface ens33 # defaults to eth0. Be sure to modify it.
Virtual_router_id 51
Priority 100 # the other server has a priority lower than 100
Advert_int 1
Authentication {
Auth_type PASS
Auth_pass 1111
}
Virtual_ipaddress {
192.168.1.19
}
}
Turn off master and test whether slave can take over from master
Systemctl stop keepalived
View on slave
Tail-f / var/log/messages
Jul 24 14:09:37 jenkins-slave Keepalived_vrrp [3340]: VRRP_Instance (VI_1) Entering MASTER STATE
Configure haproxy
Cd / usr/local/src/
Upload the haproxy package to this directory
Yum install gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools vim iotop bc zip unzip zlib-devel lrzsz tree screen lsof tcpdump wget ntpdate-y
Tar xvf haproxy-1.8.13.tar.gz
Cd haproxy-1.8.13/
Make ARCH=x86_64 TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 USE_CPU_AFFINITY=1 PREFIX=/usr/local/haproxy
Make install PREFIX=/usr/local/haproxy
Cp haproxy / usr/sbin/
Haproxy-v
Prepare the startup script
Vim / usr/lib/systemd/system/haproxy.service
[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target
[Service]
ExecStartPre=/usr/sbin/haproxy-f / etc/haproxy/haproxy.cfg-f / etc/haproxy/conf-c-Q
ExecStart=/usr/sbin/haproxy-Ws-f / etc/haproxy/haproxy.cfg-f / etc/haproxy/conf-p / r
Un/haproxy.pidExecReload=/bin/kill-USR2 $MAINPID
[Install]
WantedBy=multi-user.target
Prepare the haproxy profile
This directory is required in the mkdir-p / var/lib/haproxy # configuration file
Mkdir-p / etc/haproxy/conf
Cd / etc/haproxy/
Vim haproxy.cfg
Global
Maxconn 100000
Chroot / usr/local/haproxy
Stats socket / var/lib/haproxy/haproxy.sock mode 60000level admin # dynamically adjust the backend
Uid 99
Gid 99
Daemon
Nbproc 4
Cpu-map 1 0
Cpu-map 2 1
Cpu-map 3 2
Cpu-map 4 3
Pidfile / usr/local/haproxy/run/haproxy.pid
Log 127.0.0.1 local3 info
Defaults
Option http-keep-alive
Option forwardfor
Maxconn 100000
Mode http
Timeout connect 300000ms
Timeout client 300000ms
Timeout server 300000ms
Listen stats
Mode http
Bind 0.0.0.0:9999
Stats enable
Log global
Stats uri / haproxy-status
Stats auth admin:mypassword
Http://192.168.1.19:9999/haproxy-status
Prepare the business profile
Cd conf/
Vim tomcat-server.cfg
Listen web_port
Bind 192.168.1.19:80 # VIP
Mode http
Log global
Server 192.168.1.17 192.168.1.17:8080 check inter 3000 fall 2 rise 5
Server 192.168.1.18 192.168.1.18:8080 check inter 3000 fall 2 rise 5
Sysctl-a | grep nonlocal
Sysctl-a | grep forward
Vim / etc/sysctl.conf
Net.ipv4.ip_nonlocal_bind = 1
Net.ipv4.ip_forward = 1
Sysctl-p
Systemctl start haproxy
Systemctl enable haproxy
Systemctl status haproxy
Ss-tnl | grep 80
LISTEN 0 128 192.168.1.19:80:
Http://192.168.1.19/web01/
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.