In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In the experiment, at least three virtual machines are required, in the same network segment, 172.18 to 16172.18.10.10 to 11, of which 172.18.200.100 is used as DR.
And two network cards are configured, and the address of the other network card can no longer be in the 171.18 Universe 16 network segment.
[root@localhost ~] # ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
Link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Inet 127.0.0.1/8 scope host lo
Inet6:: 1/128 scope host
Valid_lft forever preferred_lft forever
2: eth2: mtu 1500 qdisc pfifo_fast state UP qlen 1000
Link/ether 00:0c:29:23:f3:8d brd ff:ff:ff:ff:ff:ff
Inet 172.18.200.100/16 brd 172.18.255.255 scope global eth2
Inet6 fe80::20c:29ff:fe23:f38d/64 scope link
Valid_lft forever preferred_lft forever
3: eth3: mtu 1500 qdisc pfifo_fast state UP qlen 1000
Link/ether 00:0c:29:23:f3:97 brd ff:ff:ff:ff:ff:ff
Inet 192.168.10.100/24 brd 192.168.10.255 scope global eth3
Inet6 fe80::20c:29ff:fe23:f397/64 scope link
Valid_lft forever preferred_lft forever
1. Use yum to install php and httpd on 10max 11
[root@localhost ~] # yum install php httpd
2. Configure time synchronization. Install the chrony installation package first, and then configure it.
[root@localhost ~] # yum install-y chrony
[root@localhost ~] # vim / etc/chrony.conf
# Allow NTP client access from local network.
# allow 192.168/16
Allow 172.18/16
# Serve time even if not synchronized to any NTP server.
Local stratum 10
3. Start the chrony service
[root@localhost ~] # service chronyd start
Starting chronyd: [OK]
4. Install the daemon for synchronization time in order to synchronize time every time
Install chrony on two Vs
[root@localhost ~] # yum install-y chrony
[root@localhost ~] # yum install-y chrony
Edit the configuration file, the same configuration for two VS machines
[root@localhost ~] # vim / etc/chrony.conf
# server 0.rhel.pool.ntp.org iburst
# server 1.rhel.pool.ntp.org iburst
# server 2.rhel.pool.ntp.org iburst
# server 3.rhel.pool.ntp.org iburst
Server 172.18.200.100 iburst
Start the chrony service with the same configuration for both VS machines
[root@localhost ~] # service chronyd start
Starting chronyd: [OK]
5. Synchronize time with the server
[root@localhost ~] # ntpdate 172.18.200.100
10 May 02:13:57 ntpdate [3324]: step time server 172.18.200.100 offset-2587.052960 sec
[root@localhost ~] # ntpdate 172.18.200.100
10 May 02:13:57 ntpdate [3324]: step time server 172.18.200.100 offset-2587.052960 sec
[root@localhost ~] # date
Wed May 10 02:31:05 CST 2017
[root@localhost ~] # date
Wed May 10 02:31:08 CST 2017
6. Provide relevant homepages on two VS hosts
Here we use a simple for loop to quickly generate 10 page test files.
[root@localhost ~] # for i in {1.. 20}; do echo "Test Page $i on UpStream Server 1 (172.18.10.10)" > / var/www/html/test$i.html;done
[root@localhost html] # ls / var/www/html/
Test10.html test12.html test14.html test16.html test18.html test1.html test2.html test4.html test6.html test8.html
Test11.html test13.html test15.html test17.html test19.html test20.html test3.html test5.html test7.html test9.html
Another machine does the same thing.
7. Start the httpd service (10Compact 11)
Root@localhost html] # service httpd start
8. Test on the DR server and use curl to test whether the page can be accessed.
[root@localhost ~] # curl http://172.18.10.10/test1.html
Test Page 1 on UpStream Server 1 (172.18.10.10)
[root@localhost ~] # curl http://172.18.10.11/test1.html
Test Page 1 on UpStream Server 1 (172.18.10.11)
9. Download and install nginx on the DR side. A version above nginx1.10 cannot be installed due to the use of centos6.8.
Lftp 172.18.0.1:/pub/Sources/6.x86_64/nginx > ls
-rw-r--r-- 1500500 714233 Jul 25 2013 nginx-1.0.15-5.el6.src.rpm
-rwxr--r-- 1500500 319456 Apr 24 2014 nginx-1.4.7-1.el6.ngx.x86_64.rpm
-rw-r--r-- 1 0 344416 Sep 16 2014 nginx-1.6.2-1.el6.ngx.x86_64.rpm
Lftp 172.18.0.1:/pub/Sources/6.x86_64/nginx > mget nginx-1.6.2-1.el6.ngx.x86_64.rpm
344416 bytes transferred
Lftp 172.18.0.1:/pub/Sources/6.x86_64/nginx > bye
Install nginx
[root@localhost ~] # yum install nginx-1.6.2-1.el6.ngx.x86_64.rpm
10. Configure nginx as a reverse proxy server only
[root@localhost ~] # cd / etc/nginx/conf.d/
[root@localhost conf.d] # ls
Default.conf example_ssl.conf
[root@localhost conf.d] # cp default.conf default.conf.bak
[root@localhost conf.d] # ls
Default.conf default.conf.bak example_ssl.conf
Because you want to define the group first, edit the nginx.conf file first
[root@localhost nginx] # ls
Conf.d fastcgi_params koi-utf koi-win mime.types nginx.conf scgi_params uwsgi_params win-utf
[root@localhost nginx] # vim nginx.conf
Define the upstream module in the context of http, as follows
Http {
Include / etc/nginx/mime.types
Default_type application/octet-stream
Log_format main'$remote_addr-$remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent"$http_x_forwarded_for"'
Access_log / var/log/nginx/access.log main
Sendfile on
# tcp_nopush on
Keepalive_timeout 65
# gzip on
Upstream websrvs {
Server 172.18.10.10:80
Server 172.18.10.11:80
}
Include / etc/nginx/conf.d/*.conf
} Edit the default.conf file in the conf.d file
[root@localhost conf.d] # vim default.conf
Edit the proxy_pass reverse proxy file in the context of location
Server {
Listen 80
Server_name localhost
# charset koi8-r
# access_log / var/log/nginx/log/host.access.log main
Location / {
Proxy_pass http://websrvs;
Root / usr/share/nginx/html
Index index.html index.htm
Nginx-t check configuration file syntax
10. Start the nginx service
[root@localhost conf.d] # nginx
Check to see if listening port 80 is open
[root@localhost conf.d] # ss-tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *: 80 *: *
LISTEN 0 128:: 22: *
LISTEN 0 128 *: 22 *: *
LISTEN 0 100:: 1:25: *
LISTEN 0 100 127.0.0.1:25
11. Use the curl command on the client to visit the page 10 times at a time to see the effect
[root@localhost] # for
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.