nginx 搭建 netty5 负载均衡

5 篇文章 0 订阅
3 篇文章 0 订阅

nginx 搭建netty5 负载均衡

1、 下载nginx

[root@localhost ~]# wget http://nginx.org/download/nginx-1.12.2.tar.gz
--2020-05-21 11:01:25--  http://nginx.org/download/nginx-1.12.2.tar.gz
正在解析主机 nginx.org (nginx.org)... 62.210.92.35, 95.211.80.227, 2001:1af8:4060:a004:21::e3
正在连接 nginx.org (nginx.org)|62.210.92.35|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:981687 (959K) [application/octet-stream]
正在保存至: “nginx-1.12.2.tar.gz”

100%[=====================================================================================================================>] 981,687     15.1KB/s 用时 53s    

2020-05-21 11:02:19 (18.0 KB/s) - 已保存 “nginx-1.12.2.tar.gz” [981687/981687])

您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# 

2 、安装环境

#yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel
[root@localhost ~]# yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.cn99.com
 * updates: mirrors.aliyun.com
base                                                                                                                                    | 3.6 kB  00:00:00     
extras                                                                                                                                  | 2.9 kB  00:00:00     
updates                                                                                                                                 | 2.9 kB  00:00:00     
extras/7/x86_64/primary_db                                                                                                              | 194 kB  00:00:00     
软件包 zlib-1.2.7-18.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc-c++.x86_64.0.4.8.5-39.el7 将被 安装
--> 正在处理依赖关系 libstdc++-devel = 4.8.5-39.el7,它被软件包 gcc-c++-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 libstdc++ = 4.8.5-39.el7,它被软件包 gcc-c++-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 gcc = 4.8.5-39.el7,它被软件包 gcc-c++-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 libmpfr.so.4()(64bit),它被软件包 gcc-c++-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 libmpc.so.3()(64bit),它被软件包 gcc-c++-4.8.5-39.el7.x86_64 需要
---> 软件包 libtool.x86_64.0.2.4.2-22.el7_3 将被 安装
--> 正在处理依赖关系 automake,它被软件包 libtool-2.4.2-22.el7_3.x86_64 需要
--> 正在处理依赖关系 autoconf,它被软件包 libtool-2.4.2-22.el7_3.x86_64 需要
---> 软件包 make.x86_64.1.3.82-23.el7 将被 升级
---> 软件包 make.x86_64.1.3.82-24.el7 将被 更新
---> 软件包 openssl.x86_64.1.1.0.2k-16.el7 将被 升级
---> 软件包 openssl.x86_64.1.1.0.2k-19.el7 将被 更新
--> 正在处理依赖关系 openssl-libs(x86-64) = 1:1.0.2k-19.el7,它被软件包 1:openssl-1.0.2k-19.el7.x86_64 需要
---> 软件包 openssl-devel.x86_64.1.1.0.2k-19.el7 将被 安装
--> 正在处理依赖关系 krb5-devel(x86-64),它被软件包 1:openssl-devel-1.0.2k-19.el7.x86_64 需要
---> 软件包 zlib-devel.x86_64.0.1.2.7-18.el7 将被 安装
--> 正在检查事务
---> 软件包 autoconf.noarch.0.2.69-11.el7 将被 安装
--> 正在处理依赖关系 m4 >= 1.4.14,它被软件包 autoconf-2.69-11.el7.noarch 需要
--> 正在处理依赖关系 perl(Data::Dumper),它被软件包 autoconf-2.69-11.el7.noarch 需要
---> 软件包 automake.noarch.0.1.13.4-3.el7 将被 安装
--> 正在处理依赖关系 perl(Thread::Queue),它被软件包 automake-1.13.4-3.el7.noarch 需要
--> 正在处理依赖关系 perl(TAP::Parser),它被软件包 automake-1.13.4-3.el7.noarch 需要
---> 软件包 gcc.x86_64.0.4.8.5-39.el7 将被 安装
--> 正在处理依赖关系 libgomp = 4.8.5-39.el7,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 cpp = 4.8.5-39.el7,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 libgcc >= 4.8.5-39.el7,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 glibc-devel >= 2.2.90-12,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
---> 软件包 krb5-devel.x86_64.0.1.15.1-46.el7 将被 安装
--> 正在处理依赖关系 libkadm5(x86-64) = 1.15.1-46.el7,它被软件包 krb5-devel-1.15.1-46.el7.x86_64 需要
--> 正在处理依赖关系 krb5-libs(x86-64) = 1.15.1-46.el7,它被软件包 krb5-devel-1.15.1-46.el7.x86_64 需要
--> 正在处理依赖关系 libverto-devel,它被软件包 krb5-devel-1.15.1-46.el7.x86_64 需要
--> 正在处理依赖关系 libselinux-devel,它被软件包 krb5-devel-1.15.1-46.el7.x86_64 需要
--> 正在处理依赖关系 libcom_err-devel,它被软件包 krb5-devel-1.15.1-46.el7.x86_64 需要
--> 正在处理依赖关系 keyutils-libs-devel,它被软件包 krb5-devel-1.15.1-46.el7.x86_64 需要
---> 软件包 libmpc.x86_64.0.1.0.1-3.el7 将被 安装
---> 软件包 libstdc++.x86_64.0.4.8.5-36.el7 将被 升级
---> 软件包 libstdc++.x86_64.0.4.8.5-39.el7 将被 更新
---> 软件包 libstdc++-devel.x86_64.0.4.8.5-39.el7 将被 安装
---> 软件包 mpfr.x86_64.0.3.1.1-4.el7 将被 安装
---> 软件包 openssl-libs.x86_64.1.1.0.2k-16.el7 将被 升级
---> 软件包 openssl-libs.x86_64.1.1.0.2k-19.el7 将被 更新
--> 正在检查事务
---> 软件包 cpp.x86_64.0.4.8.5-39.el7 将被 安装
---> 软件包 glibc-devel.x86_64.0.2.17-307.el7.1 将被 安装
--> 正在处理依赖关系 glibc-headers = 2.17-307.el7.1,它被软件包 glibc-devel-2.17-307.el7.1.x86_64 需要
--> 正在处理依赖关系 glibc = 2.17-307.el7.1,它被软件包 glibc-devel-2.17-307.el7.1.x86_64 需要
--> 正在处理依赖关系 glibc-headers,它被软件包 glibc-devel-2.17-307.el7.1.x86_64 需要
---> 软件包 keyutils-libs-devel.x86_64.0.1.5.8-3.el7 将被 安装
---> 软件包 krb5-libs.x86_64.0.1.15.1-34.el7 将被 升级
---> 软件包 krb5-libs.x86_64.0.1.15.1-46.el7 将被 更新
---> 软件包 libcom_err-devel.x86_64.0.1.42.9-17.el7 将被 安装
--> 正在处理依赖关系 libcom_err(x86-64) = 1.42.9-17.el7,它被软件包 libcom_err-devel-1.42.9-17.el7.x86_64 需要
---> 软件包 libgcc.x86_64.0.4.8.5-36.el7 将被 升级
---> 软件包 libgcc.x86_64.0.4.8.5-39.el7 将被 更新
---> 软件包 libgomp.x86_64.0.4.8.5-36.el7 将被 升级
---> 软件包 libgomp.x86_64.0.4.8.5-39.el7 将被 更新
---> 软件包 libkadm5.x86_64.0.1.15.1-46.el7 将被 安装
---> 软件包 libselinux-devel.x86_64.0.2.5-15.el7 将被 安装
--> 正在处理依赖关系 libselinux(x86-64) = 2.5-15.el7,它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
--> 正在处理依赖关系 libsepol-devel(x86-64) >= 2.5-10,它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
--> 正在处理依赖关系 pkgconfig(libsepol),它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
--> 正在处理依赖关系 pkgconfig(libpcre),它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
---> 软件包 libverto-devel.x86_64.0.0.2.5-4.el7 将被 安装
---> 软件包 m4.x86_64.0.1.4.16-10.el7 将被 安装
---> 软件包 perl-Data-Dumper.x86_64.0.2.145-3.el7 将被 安装
---> 软件包 perl-Test-Harness.noarch.0.3.28-3.el7 将被 安装
---> 软件包 perl-Thread-Queue.noarch.0.3.02-2.el7 将被 安装
--> 正在检查事务
---> 软件包 glibc.x86_64.0.2.17-260.el7 将被 升级
--> 正在处理依赖关系 glibc = 2.17-260.el7,它被软件包 glibc-common-2.17-260.el7.x86_64 需要
---> 软件包 glibc.x86_64.0.2.17-307.el7.1 将被 更新
---> 软件包 glibc-headers.x86_64.0.2.17-307.el7.1 将被 安装
--> 正在处理依赖关系 kernel-headers >= 2.2.1,它被软件包 glibc-headers-2.17-307.el7.1.x86_64 需要
--> 正在处理依赖关系 kernel-headers,它被软件包 glibc-headers-2.17-307.el7.1.x86_64 需要
---> 软件包 libcom_err.x86_64.0.1.42.9-13.el7 将被 升级
--> 正在处理依赖关系 libcom_err(x86-64) = 1.42.9-13.el7,它被软件包 e2fsprogs-1.42.9-13.el7.x86_64 需要
--> 正在处理依赖关系 libcom_err(x86-64) = 1.42.9-13.el7,它被软件包 e2fsprogs-libs-1.42.9-13.el7.x86_64 需要
--> 正在处理依赖关系 libcom_err(x86-64) = 1.42.9-13.el7,它被软件包 libss-1.42.9-13.el7.x86_64 需要
---> 软件包 libcom_err.x86_64.0.1.42.9-17.el7 将被 更新
---> 软件包 libselinux.x86_64.0.2.5-14.1.el7 将被 升级
--> 正在处理依赖关系 libselinux(x86-64) = 2.5-14.1.el7,它被软件包 libselinux-python-2.5-14.1.el7.x86_64 需要
--> 正在处理依赖关系 libselinux(x86-64) = 2.5-14.1.el7,它被软件包 libselinux-utils-2.5-14.1.el7.x86_64 需要
---> 软件包 libselinux.x86_64.0.2.5-15.el7 将被 更新
---> 软件包 libsepol-devel.x86_64.0.2.5-10.el7 将被 安装
---> 软件包 pcre-devel.x86_64.0.8.32-17.el7 将被 安装
--> 正在检查事务
---> 软件包 e2fsprogs.x86_64.0.1.42.9-13.el7 将被 升级
---> 软件包 e2fsprogs.x86_64.0.1.42.9-17.el7 将被 更新
---> 软件包 e2fsprogs-libs.x86_64.0.1.42.9-13.el7 将被 升级
---> 软件包 e2fsprogs-libs.x86_64.0.1.42.9-17.el7 将被 更新
---> 软件包 glibc-common.x86_64.0.2.17-260.el7 将被 升级
---> 软件包 glibc-common.x86_64.0.2.17-307.el7.1 将被 更新
---> 软件包 kernel-headers.x86_64.0.3.10.0-1127.8.2.el7 将被 安装
---> 软件包 libselinux-python.x86_64.0.2.5-14.1.el7 将被 升级
---> 软件包 libselinux-python.x86_64.0.2.5-15.el7 将被 更新
---> 软件包 libselinux-utils.x86_64.0.2.5-14.1.el7 将被 升级
---> 软件包 libselinux-utils.x86_64.0.2.5-15.el7 将被 更新
---> 软件包 libss.x86_64.0.1.42.9-13.el7 将被 升级
---> 软件包 libss.x86_64.0.1.42.9-17.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

===============================================================================================================================================================
 Package                                     架构                           版本                                         源                               大小
===============================================================================================================================================================
正在安装:
 gcc-c++                                     x86_64                         4.8.5-39.el7                                 base                            7.2 M
 libtool                                     x86_64                         2.4.2-22.el7_3                               base                            588 k
 openssl-devel                               x86_64                         1:1.0.2k-19.el7                              base                            1.5 M
 zlib-devel                                  x86_64                         1.2.7-18.el7                                 base                             50 k
正在更新:
 make                                        x86_64                         1:3.82-24.el7                                base                            421 k
 openssl                                     x86_64                         1:1.0.2k-19.el7                              base                            493 k
为依赖而安装:
 autoconf                                    noarch                         2.69-11.el7                                  base                            701 k
 automake                                    noarch                         1.13.4-3.el7                                 base                            679 k
 cpp                                         x86_64                         4.8.5-39.el7                                 base                            5.9 M
 gcc                                         x86_64                         4.8.5-39.el7                                 base                             16 M
 glibc-devel                                 x86_64                         2.17-307.el7.1                               base                            1.1 M
 glibc-headers                               x86_64                         2.17-307.el7.1                               base                            689 k
 kernel-headers                              x86_64                         3.10.0-1127.8.2.el7                          updates                         8.9 M
 keyutils-libs-devel                         x86_64                         1.5.8-3.el7                                  base                             37 k
 krb5-devel                                  x86_64                         1.15.1-46.el7                                base                            272 k
 libcom_err-devel                            x86_64                         1.42.9-17.el7                                base                             32 k
 libkadm5                                    x86_64                         1.15.1-46.el7                                base                            179 k
 libmpc                                      x86_64                         1.0.1-3.el7                                  base                             51 k
 libselinux-devel                            x86_64                         2.5-15.el7                                   base                            187 k
 libsepol-devel                              x86_64                         2.5-10.el7                                   base                             77 k
 libstdc++-devel                             x86_64                         4.8.5-39.el7                                 base                            1.5 M
 libverto-devel                              x86_64                         0.2.5-4.el7                                  base                             12 k
 m4                                          x86_64                         1.4.16-10.el7                                base                            256 k
 mpfr                                        x86_64                         3.1.1-4.el7                                  base                            203 k
 pcre-devel                                  x86_64                         8.32-17.el7                                  base                            480 k
 perl-Data-Dumper                            x86_64                         2.145-3.el7                                  base                             47 k
 perl-Test-Harness                           noarch                         3.28-3.el7                                   base                            302 k
 perl-Thread-Queue                           noarch                         3.02-2.el7                                   base                             17 k
为依赖而更新:
 e2fsprogs                                   x86_64                         1.42.9-17.el7                                base                            699 k
 e2fsprogs-libs                              x86_64                         1.42.9-17.el7                                base                            168 k
 glibc                                       x86_64                         2.17-307.el7.1                               base                            3.6 M
 glibc-common                                x86_64                         2.17-307.el7.1                               base                             11 M
 krb5-libs                                   x86_64                         1.15.1-46.el7                                base                            809 k
 libcom_err                                  x86_64                         1.42.9-17.el7                                base                             42 k
 libgcc                                      x86_64                         4.8.5-39.el7                                 base                            102 k
 libgomp                                     x86_64                         4.8.5-39.el7                                 base                            158 k
 libselinux                                  x86_64                         2.5-15.el7                                   base                            162 k
 libselinux-python                           x86_64                         2.5-15.el7                                   base                            236 k
 libselinux-utils                            x86_64                         2.5-15.el7                                   base                            151 k
 libss                                       x86_64                         1.42.9-17.el7                                base                             46 k
 libstdc++                                   x86_64                         4.8.5-39.el7                                 base                            305 k
 openssl-libs                                x86_64                         1:1.0.2k-19.el7                              base                            1.2 M

事务概要
===============================================================================================================================================================
安装  4 软件包 (+22 依赖软件包)
升级  2 软件包 (+14 依赖软件包)

总下载量:67 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/42): autoconf-2.69-11.el7.noarch.rpm                                                                                                 | 701 kB  00:00:00     
(2/42): e2fsprogs-1.42.9-17.el7.x86_64.rpm                                                                                              | 699 kB  00:00:00     
(3/42): automake-1.13.4-3.el7.noarch.rpm                                                                                                | 679 kB  00:00:00     
(4/42): e2fsprogs-libs-1.42.9-17.el7.x86_64.rpm                                                                                         | 168 kB  00:00:00     
(5/42): cpp-4.8.5-39.el7.x86_64.rpm                                                                                                     | 5.9 MB  00:00:01     
(6/42): gcc-c++-4.8.5-39.el7.x86_64.rpm                                                                                                 | 7.2 MB  00:00:01     
(7/42): gcc-4.8.5-39.el7.x86_64.rpm                                                                                                     |  16 MB  00:00:02     
(8/42): glibc-devel-2.17-307.el7.1.x86_64.rpm                                                                                           | 1.1 MB  00:00:00     
(9/42): glibc-headers-2.17-307.el7.1.x86_64.rpm                                                                                         | 689 kB  00:00:00     
(10/42): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm                                                                                     |  37 kB  00:00:00     
(11/42): krb5-devel-1.15.1-46.el7.x86_64.rpm                                                                                            | 272 kB  00:00:00     
(12/42): krb5-libs-1.15.1-46.el7.x86_64.rpm                                                                                             | 809 kB  00:00:00     
(13/42): glibc-2.17-307.el7.1.x86_64.rpm                                                                                                | 3.6 MB  00:00:01     
(14/42): libcom_err-1.42.9-17.el7.x86_64.rpm                                                                                            |  42 kB  00:00:00     
(15/42): libcom_err-devel-1.42.9-17.el7.x86_64.rpm                                                                                      |  32 kB  00:00:00     
(16/42): libgcc-4.8.5-39.el7.x86_64.rpm                                                                                                 | 102 kB  00:00:00     
(17/42): libgomp-4.8.5-39.el7.x86_64.rpm                                                                                                | 158 kB  00:00:00     
(18/42): libmpc-1.0.1-3.el7.x86_64.rpm                                                                                                  |  51 kB  00:00:00     
(19/42): libselinux-2.5-15.el7.x86_64.rpm                                                                                               | 162 kB  00:00:00     
(20/42): libkadm5-1.15.1-46.el7.x86_64.rpm                                                                                              | 179 kB  00:00:00     
(21/42): libselinux-devel-2.5-15.el7.x86_64.rpm                                                                                         | 187 kB  00:00:00     
(22/42): libselinux-utils-2.5-15.el7.x86_64.rpm                                                                                         | 151 kB  00:00:00     
(23/42): libsepol-devel-2.5-10.el7.x86_64.rpm                                                                                           |  77 kB  00:00:00     
(24/42): libss-1.42.9-17.el7.x86_64.rpm                                                                                                 |  46 kB  00:00:00     
(25/42): libselinux-python-2.5-15.el7.x86_64.rpm                                                                                        | 236 kB  00:00:00     
(26/42): libstdc++-4.8.5-39.el7.x86_64.rpm                                                                                              | 305 kB  00:00:00     
(27/42): libtool-2.4.2-22.el7_3.x86_64.rpm                                                                                              | 588 kB  00:00:00     
(28/42): libstdc++-devel-4.8.5-39.el7.x86_64.rpm                                                                                        | 1.5 MB  00:00:00     
(29/42): libverto-devel-0.2.5-4.el7.x86_64.rpm                                                                                          |  12 kB  00:00:00     
(30/42): m4-1.4.16-10.el7.x86_64.rpm                                                                                                    | 256 kB  00:00:00     
(31/42): mpfr-3.1.1-4.el7.x86_64.rpm                                                                                                    | 203 kB  00:00:00     
(32/42): make-3.82-24.el7.x86_64.rpm                                                                                                    | 421 kB  00:00:00     
(33/42): openssl-1.0.2k-19.el7.x86_64.rpm                                                                                               | 493 kB  00:00:00     
(34/42): openssl-libs-1.0.2k-19.el7.x86_64.rpm                                                                                          | 1.2 MB  00:00:00     
(35/42): pcre-devel-8.32-17.el7.x86_64.rpm                                                                                              | 480 kB  00:00:00     
(36/42): openssl-devel-1.0.2k-19.el7.x86_64.rpm                                                                                         | 1.5 MB  00:00:00     
(37/42): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                                        |  47 kB  00:00:00     
(38/42): zlib-devel-1.2.7-18.el7.x86_64.rpm                                                                                             |  50 kB  00:00:00     
(39/42): perl-Thread-Queue-3.02-2.el7.noarch.rpm                                                                                        |  17 kB  00:00:00     
(40/42): perl-Test-Harness-3.28-3.el7.noarch.rpm                                                                                        | 302 kB  00:00:00     
(41/42): kernel-headers-3.10.0-1127.8.2.el7.x86_64.rpm                                                                                  | 8.9 MB  00:00:02     
glibc-common-2.17-307.el7.1.x8 FAILED                                          
http://mirrors.ustc.edu.cn/centos/7.8.2003/os/x86_64/Packages/glibc-common-2.17-307.el7.1.x86_64.rpm: [Errno 12] Timeout on http://mirrors.ustc.edu.cn/centos/7.8.2003/os/x86_64/Packages/glibc-common-2.17-307.el7.1.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
(42/42): glibc-common-2.17-307.el7.1.x86_64.rpm                                                                                         |  11 MB  00:00:01     
---------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                           2.0 MB/s |  67 MB  00:00:34     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : libgcc-4.8.5-39.el7.x86_64                                                                                                                1/58 
  正在更新    : glibc-common-2.17-307.el7.1.x86_64                                                                                                        2/58 
  正在更新    : glibc-2.17-307.el7.1.x86_64                                                                                                               3/58 
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
  正在更新    : libselinux-2.5-15.el7.x86_64                                                                                                              4/58 
  正在更新    : libcom_err-1.42.9-17.el7.x86_64                                                                                                           5/58 
  正在更新    : 1:openssl-libs-1.0.2k-19.el7.x86_64                                                                                                       6/58 
  正在更新    : krb5-libs-1.15.1-46.el7.x86_64                                                                                                            7/58 
  正在安装    : mpfr-3.1.1-4.el7.x86_64                                                                                                                   8/58 
  正在安装    : libmpc-1.0.1-3.el7.x86_64                                                                                                                 9/58 
  正在更新    : libstdc++-4.8.5-39.el7.x86_64                                                                                                            10/58 
  正在安装    : libstdc++-devel-4.8.5-39.el7.x86_64                                                                                                      11/58 
  正在安装    : cpp-4.8.5-39.el7.x86_64                                                                                                                  12/58 
  正在安装    : libkadm5-1.15.1-46.el7.x86_64                                                                                                            13/58 
  正在安装    : libcom_err-devel-1.42.9-17.el7.x86_64                                                                                                    14/58 
  正在更新    : e2fsprogs-libs-1.42.9-17.el7.x86_64                                                                                                      15/58 
  正在更新    : libss-1.42.9-17.el7.x86_64                                                                                                               16/58 
  正在安装    : m4-1.4.16-10.el7.x86_64                                                                                                                  17/58 
  正在更新    : libgomp-4.8.5-39.el7.x86_64                                                                                                              18/58 
  正在更新    : 1:make-3.82-24.el7.x86_64                                                                                                                19/58 
  正在安装    : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                      20/58 
  正在安装    : autoconf-2.69-11.el7.noarch                                                                                                              21/58 
  正在安装    : kernel-headers-3.10.0-1127.8.2.el7.x86_64                                                                                                22/58 
  正在安装    : glibc-headers-2.17-307.el7.1.x86_64                                                                                                      23/58 
  正在安装    : glibc-devel-2.17-307.el7.1.x86_64                                                                                                        24/58 
  正在安装    : gcc-4.8.5-39.el7.x86_64                                                                                                                  25/58 
  正在安装    : perl-Thread-Queue-3.02-2.el7.noarch                                                                                                      26/58 
  正在安装    : perl-Test-Harness-3.28-3.el7.noarch                                                                                                      27/58 
  正在安装    : automake-1.13.4-3.el7.noarch                                                                                                             28/58 
  正在安装    : zlib-devel-1.2.7-18.el7.x86_64                                                                                                           29/58 
  正在安装    : libverto-devel-0.2.5-4.el7.x86_64                                                                                                        30/58 
  正在安装    : libsepol-devel-2.5-10.el7.x86_64                                                                                                         31/58 
  正在安装    : pcre-devel-8.32-17.el7.x86_64                                                                                                            32/58 
  正在安装    : libselinux-devel-2.5-15.el7.x86_64                                                                                                       33/58 
  正在安装    : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                                                                   34/58 
  正在安装    : krb5-devel-1.15.1-46.el7.x86_64                                                                                                          35/58 
  正在安装    : 1:openssl-devel-1.0.2k-19.el7.x86_64                                                                                                     36/58 
  正在安装    : libtool-2.4.2-22.el7_3.x86_64                                                                                                            37/58 
  正在安装    : gcc-c++-4.8.5-39.el7.x86_64                                                                                                              38/58 
  正在更新    : 1:openssl-1.0.2k-19.el7.x86_64                                                                                                           39/58 
  正在更新    : e2fsprogs-1.42.9-17.el7.x86_64                                                                                                           40/58 
  正在更新    : libselinux-utils-2.5-15.el7.x86_64                                                                                                       41/58 
  正在更新    : libselinux-python-2.5-15.el7.x86_64                                                                                                      42/58 
  清理        : 1:openssl-1.0.2k-16.el7.x86_64                                                                                                           43/58 
  清理        : e2fsprogs-1.42.9-13.el7.x86_64                                                                                                           44/58 
  清理        : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                                                      45/58 
  清理        : krb5-libs-1.15.1-34.el7.x86_64                                                                                                           46/58 
  清理        : e2fsprogs-libs-1.42.9-13.el7.x86_64                                                                                                      47/58 
  清理        : libss-1.42.9-13.el7.x86_64                                                                                                               48/58 
  清理        : libselinux-python-2.5-14.1.el7.x86_64                                                                                                    49/58 
  清理        : libselinux-utils-2.5-14.1.el7.x86_64                                                                                                     50/58 
  清理        : libstdc++-4.8.5-36.el7.x86_64                                                                                                            51/58 
  清理        : libcom_err-1.42.9-13.el7.x86_64                                                                                                          52/58 
  清理        : 1:make-3.82-23.el7.x86_64                                                                                                                53/58 
  清理        : libgomp-4.8.5-36.el7.x86_64                                                                                                              54/58 
  清理        : libselinux-2.5-14.1.el7.x86_64                                                                                                           55/58 
  清理        : glibc-common-2.17-260.el7.x86_64                                                                                                         56/58 
  清理        : glibc-2.17-260.el7.x86_64                                                                                                                57/58 
  清理        : libgcc-4.8.5-36.el7.x86_64                                                                                                               58/58 
  验证中      : libselinux-devel-2.5-15.el7.x86_64                                                                                                        1/58 
  验证中      : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                                                                    2/58 
  验证中      : krb5-libs-1.15.1-46.el7.x86_64                                                                                                            3/58 
  验证中      : libselinux-2.5-15.el7.x86_64                                                                                                              4/58 
  验证中      : pcre-devel-8.32-17.el7.x86_64                                                                                                             5/58 
  验证中      : libcom_err-1.42.9-17.el7.x86_64                                                                                                           6/58 
  验证中      : automake-1.13.4-3.el7.noarch                                                                                                              7/58 
  验证中      : m4-1.4.16-10.el7.x86_64                                                                                                                   8/58 
  验证中      : libstdc++-4.8.5-39.el7.x86_64                                                                                                             9/58 
  验证中      : libsepol-devel-2.5-10.el7.x86_64                                                                                                         10/58 
  验证中      : gcc-4.8.5-39.el7.x86_64                                                                                                                  11/58 
  验证中      : libverto-devel-0.2.5-4.el7.x86_64                                                                                                        12/58 
  验证中      : libselinux-utils-2.5-15.el7.x86_64                                                                                                       13/58 
  验证中      : zlib-devel-1.2.7-18.el7.x86_64                                                                                                           14/58 
  验证中      : perl-Test-Harness-3.28-3.el7.noarch                                                                                                      15/58 
  验证中      : perl-Thread-Queue-3.02-2.el7.noarch                                                                                                      16/58 
  验证中      : e2fsprogs-1.42.9-17.el7.x86_64                                                                                                           17/58 
  验证中      : glibc-common-2.17-307.el7.1.x86_64                                                                                                       18/58 
  验证中      : libgcc-4.8.5-39.el7.x86_64                                                                                                               19/58 
  验证中      : libgomp-4.8.5-39.el7.x86_64                                                                                                              20/58 
  验证中      : 1:make-3.82-24.el7.x86_64                                                                                                                21/58 
  验证中      : libcom_err-devel-1.42.9-17.el7.x86_64                                                                                                    22/58 
  验证中      : libstdc++-devel-4.8.5-39.el7.x86_64                                                                                                      23/58 
  验证中      : glibc-2.17-307.el7.1.x86_64                                                                                                              24/58 
  验证中      : libtool-2.4.2-22.el7_3.x86_64                                                                                                            25/58 
  验证中      : krb5-devel-1.15.1-46.el7.x86_64                                                                                                          26/58 
  验证中      : e2fsprogs-libs-1.42.9-17.el7.x86_64                                                                                                      27/58 
  验证中      : kernel-headers-3.10.0-1127.8.2.el7.x86_64                                                                                                28/58 
  验证中      : libkadm5-1.15.1-46.el7.x86_64                                                                                                            29/58 
  验证中      : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                      30/58 
  验证中      : gcc-c++-4.8.5-39.el7.x86_64                                                                                                              31/58 
  验证中      : 1:openssl-1.0.2k-19.el7.x86_64                                                                                                           32/58 
  验证中      : libselinux-python-2.5-15.el7.x86_64                                                                                                      33/58 
  验证中      : 1:openssl-devel-1.0.2k-19.el7.x86_64                                                                                                     34/58 
  验证中      : libmpc-1.0.1-3.el7.x86_64                                                                                                                35/58 
  验证中      : glibc-headers-2.17-307.el7.1.x86_64                                                                                                      36/58 
  验证中      : 1:openssl-libs-1.0.2k-19.el7.x86_64                                                                                                      37/58 
  验证中      : libss-1.42.9-17.el7.x86_64                                                                                                               38/58 
  验证中      : autoconf-2.69-11.el7.noarch                                                                                                              39/58 
  验证中      : glibc-devel-2.17-307.el7.1.x86_64                                                                                                        40/58 
  验证中      : mpfr-3.1.1-4.el7.x86_64                                                                                                                  41/58 
  验证中      : cpp-4.8.5-39.el7.x86_64                                                                                                                  42/58 
  验证中      : libcom_err-1.42.9-13.el7.x86_64                                                                                                          43/58 
  验证中      : libgcc-4.8.5-36.el7.x86_64                                                                                                               44/58 
  验证中      : libstdc++-4.8.5-36.el7.x86_64                                                                                                            45/58 
  验证中      : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                                                      46/58 
  验证中      : libss-1.42.9-13.el7.x86_64                                                                                                               47/58 
  验证中      : 1:openssl-1.0.2k-16.el7.x86_64                                                                                                           48/58 
  验证中      : libgomp-4.8.5-36.el7.x86_64                                                                                                              49/58 
  验证中      : glibc-common-2.17-260.el7.x86_64                                                                                                         50/58 
  验证中      : 1:make-3.82-23.el7.x86_64                                                                                                                51/58 
  验证中      : glibc-2.17-260.el7.x86_64                                                                                                                52/58 
  验证中      : libselinux-python-2.5-14.1.el7.x86_64                                                                                                    53/58 
  验证中      : e2fsprogs-libs-1.42.9-13.el7.x86_64                                                                                                      54/58 
  验证中      : krb5-libs-1.15.1-34.el7.x86_64                                                                                                           55/58 
  验证中      : libselinux-utils-2.5-14.1.el7.x86_64                                                                                                     56/58 
  验证中      : libselinux-2.5-14.1.el7.x86_64                                                                                                           57/58 
  验证中      : e2fsprogs-1.42.9-13.el7.x86_64                                                                                                           58/58 

已安装:
  gcc-c++.x86_64 0:4.8.5-39.el7       libtool.x86_64 0:2.4.2-22.el7_3       openssl-devel.x86_64 1:1.0.2k-19.el7       zlib-devel.x86_64 0:1.2.7-18.el7      

作为依赖被安装:
  autoconf.noarch 0:2.69-11.el7                          automake.noarch 0:1.13.4-3.el7                      cpp.x86_64 0:4.8.5-39.el7                       
  gcc.x86_64 0:4.8.5-39.el7                              glibc-devel.x86_64 0:2.17-307.el7.1                 glibc-headers.x86_64 0:2.17-307.el7.1           
  kernel-headers.x86_64 0:3.10.0-1127.8.2.el7            keyutils-libs-devel.x86_64 0:1.5.8-3.el7            krb5-devel.x86_64 0:1.15.1-46.el7               
  libcom_err-devel.x86_64 0:1.42.9-17.el7                libkadm5.x86_64 0:1.15.1-46.el7                     libmpc.x86_64 0:1.0.1-3.el7                     
  libselinux-devel.x86_64 0:2.5-15.el7                   libsepol-devel.x86_64 0:2.5-10.el7                  libstdc++-devel.x86_64 0:4.8.5-39.el7           
  libverto-devel.x86_64 0:0.2.5-4.el7                    m4.x86_64 0:1.4.16-10.el7                           mpfr.x86_64 0:3.1.1-4.el7                       
  pcre-devel.x86_64 0:8.32-17.el7                        perl-Data-Dumper.x86_64 0:2.145-3.el7               perl-Test-Harness.noarch 0:3.28-3.el7           
  perl-Thread-Queue.noarch 0:3.02-2.el7                 

更新完毕:
  make.x86_64 1:3.82-24.el7                                                   openssl.x86_64 1:1.0.2k-19.el7                                                  

作为依赖被升级:
  e2fsprogs.x86_64 0:1.42.9-17.el7    e2fsprogs-libs.x86_64 0:1.42.9-17.el7    glibc.x86_64 0:2.17-307.el7.1           glibc-common.x86_64 0:2.17-307.el7.1   
  krb5-libs.x86_64 0:1.15.1-46.el7    libcom_err.x86_64 0:1.42.9-17.el7        libgcc.x86_64 0:4.8.5-39.el7            libgomp.x86_64 0:4.8.5-39.el7          
  libselinux.x86_64 0:2.5-15.el7      libselinux-python.x86_64 0:2.5-15.el7    libselinux-utils.x86_64 0:2.5-15.el7    libss.x86_64 0:1.42.9-17.el7           
  libstdc++.x86_64 0:4.8.5-39.el7     openssl-libs.x86_64 1:1.0.2k-19.el7     

完毕!
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# 

3、 解压缩并编译安装

[root@localhost ~]#tar -xzvf nginx-1.12.2.tar.gz 
[root@localhost ~]#cd nginx-1.12.2
[root@localhost nginx-1.12.2]#./configure --prefix=/opt/nginx-1.12.2 --with-http_stub_status_module --with-http_realip_module --with-http_ssl_module --with-pcre --with-http_realip_module --with-stream

[root@localhost nginx-1.12.2]# cd /opt/
[root@localhost opt]# ll
总用量 0
drwxr-xr-x. 6 root root 54 5月  21 11:14 nginx-1.12.2
[root@localhost opt]# cd nginx-1.12.2/
[root@localhost nginx-1.12.2]# ll
总用量 4
drwxr-xr-x. 2 root root 4096 5月  21 11:14 conf
drwxr-xr-x. 2 root root   40 5月  21 11:14 html
drwxr-xr-x. 2 root root    6 5月  21 11:14 logs
drwxr-xr-x. 2 root root   19 5月  21 11:14 sbin
[root@localhost nginx-1.12.2]# cd sbin/
[root@localhost sbin]# ll
总用量 6480
-rwxr-xr-x. 1 root root 6632240 5月  21 11:14 nginx
[root@localhost sbin]# ./nginx 
[root@localhost sbin]# ./nginx 
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[root@localhost sbin]# 


4 、nginx 启动后的效果图:

在这里插入图片描述

5、修改配置


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}
 stream{
         upstream netty_test{
           server 192.168.85.1:6666 weight=1;
    
           server 192.168.85.1:7777 weight=1;
        }
      
      server {
           
            listen 6665;
            proxy_pass netty_test;


 
          }  
      }

http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

6、 重新加载配置

#./nginx -s reload

7 、测试代码:

https://gitee.com/shi860715/netty-bance.git

8 、结果

这样我们就完成了 ,服务端负载均衡的效果。
在这里插入图片描述

9 总结:

通过本轮实验,完成了tcp 长连接的,负载均衡。为了后面的结构提供技术支持和理论依据。

1、搭建nginx 服务,并配置完成后续的反向代理的功能,设置ip和代理端口

2、在服务中直接启用,nginx 自动负载均衡到各机器服务端,设备和服务端通信。

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值