In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
varnish installation
systemctl stop firewalld //close firewall setenforce 0 //turn off monitoring yum install lrz* -y //Install the upload software and pull libedit-devel-3.0-12.20121213cvs.el7.x86_64.rpmpython-docutils-0.11-0.2.20130715svn7687.el7.noarch.rpmvarnish-5.2.1.tgz soft unpacking and dependency packages into it.
yum install -y gcc gcc-c++ make //install compiler and environment install dependency packages and required plugins:yum install -y \libtool \ncourses-devel \pcre-devel\libxslt \groff \pkgconfig \ncurses-devel \python-*rpm -ivh libedit-devel-3.0-12.20121213cvs.el7.x86_64.rpmrpm -ivh python-docutils-0.11-0.2.20130715svn7687.el7.noarch.rpmtar xf varnish-5.2.1.tgz -C /opt //extract soft unpacking and dependency packages
cd /opt/varnish-5.2.1/ //Enter the extracted folder to define the required modules sh autogen.sh //check system environment
./ configure \--prefix=/usr/local/varnish \--enable-debugging-symbols \--enable-developer-warningsmake && make installcd /usr/local/varnish/ln -s /usr/local/varnish/sbin/varnishd /usr/sbin/ //softlink ln -s /usr/local/varnish/bin/* /usr/local/bin/ The requested URL/usr/local/varnish/share/doc/varnish/example.vcl /usr/local/varnish/default.vcl was not found on this server.
vi /usr/local/varnish/default.vcl Modify the following: backend default { .host = "192.168.80.101" .port = "80"}
varnishd -f /usr/local/varnish/default.vcl -a 0.0.0.0:80 //specify ip and port to listen on to start varnish
netstat -anpt | grep varnishd
Set up a web server on another Linux VM (80.101):
systemctl stop firewalld //close firewall setenforce 0 //turn off monitoring yum install -y httpd //Install httpvi /etc/httpd/conf/httpd.conf Remove #before ServerName www.example.com:80
vi /var/www/html/ index.htmlserver 1systemctl start httpd test, enter http://192.168.80.100 (ip address of varnish server) in windows browser
Varnishlog #View logs, scroll in real time
------------More than one web backend server------------
Multiple web backend servers: vi /usr/local/varnish/default.vcl Find and modify the following: vcl 4.0;import directors; //Add a line, import a directors----Add business server nodes below----backend web1 { #Modify default to web1, which is the web server behind. There are several web nodes and several backend domains are copied. .host = "192.168.80.101"; #Address of backend web server .port = "80"; #web server port}backend web2 { .host = "192.168.80.102"; .port = "80";}----Following the above code, define the scheduling algorithm and specify traffic forwarding---sub vcl_init { #Defined in the init subfunction new bar = directors.round_robin(); //random round_robin dns#Defines the server group, making the new bar equal to the previously defined variable directors, followed by the polling (rr) algorithm bar.add_backend(web1); #Notice how many backends there are, add a few bar.add_backend(web2);}sub vcl_recv { set req.backend_hint = bar.backend(); //Traffic forwarded to all nodes Note parenthesis}
varnishd -C -f /usr/local/varnish/default.vcl > /dev/null //Check the configuration file for errors
pkill -9 varnishvarnishd -f /usr/local/varnish/default.vcl
netstat -anpt | grep varnishd
Set up a web server on another Linux VM (80.102):
systemctl stop firewalld //close firewall setenforce 0 //turn off monitoring yum install -y httpd //Install httpvi /etc/httpd/conf/httpd.conf Delete the #before ServerName www.example.com:80 vi /var/www/html/index.htmlserver 2systemctl start httpd Enter 192.168.80.100 in your browser
Because of varnish caching, when we visit varnish, we don't visit the next two web servers separately according to the rr algorithm as we expected, so we let one web server network down, and varnish will visit the other one. Back-end host health detection mechanism: varnish can perform health detection on back-end hosts, and dynamically remove or restore back-end host scheduling lists.
probe healthche {define health test method, custom name
.url="/index.html"; #Requested URL when detecting, default is "/"
.timeout = 2s; #timeout
.window = 6 ; #Determine health status based on how many recent detections
.threshold = 5; #The most recent number of checks defined in the.window to have. threshold is successful;
.interval = 2s; #detection frequency;
}
Reference instrumentation when defining backend servers
backend web1 {
.host = "192.168.80.100";
.port = "80";
.probe = healthche; #Reference detection method
}
Check the detection status in the varniadm command interface, health detection backend.list
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.