当前位置: 首页 > wzjs >正文

秦皇岛网站开发多少钱现在什么网站做外贸的最好

秦皇岛网站开发多少钱,现在什么网站做外贸的最好,微信营销案例100例,如何解压wordpress文章目录 前言1. Ubuntu下nginx安装2. nginx的tcp负载配置 前言 假设一台机器支持两万的并发量,现在我们需要保证八万的并发量。首先想到的是升级服务器的配置,比如提高 CPU 执行频率,加大内存等提高机器的物理性能来解决此问题。但是单台机…

文章目录

  • 前言
  • 1. Ubuntu下nginx安装
  • 2. nginx的tcp负载配置


前言

假设一台机器支持两万的并发量,现在我们需要保证八万的并发量。首先想到的是升级服务器的配置,比如提高 CPU 执行频率,加大内存等提高机器的物理性能来解决此问题。但是单台机器的性能毕竟是有限的。

这个时候我们就可以增加服务器的数量,将用户请求分发到不同的服务器上分担压力,这就是负载均衡。那我们就需要有一个第三方组件充当负载均衡器,由它负责将不同的请求分发到不同的服务器上。这里介绍 Nginx 的负载均衡功能。
在这里插入图片描述
Nginx作为 tcp 负载均衡模块的原因:

  1. client的请求按照负载算法分发到具体的业务服务器ChatServer
  2. 能够ChantServer保持心跳机制,检测ChatServer故障
  3. 能够发现新添加的ChatServer设备,方便扩展服务器数量

1. Ubuntu下nginx安装

在服务器快速集群环境搭建中,都迫切需要一个能拿来即用的负载均衡器,nginx在1.9版本之前,只支持http协议web服务器的负载均衡,从1.9版本开始以后,nginx开始支持tcp的长连接负载均衡,但是nginx默认并没有编译tcp负载均衡模块,编写它时,需要加入–with-stream参数来激活这个模块。
nginx编译加入–with-stream参数激活tcp负载均衡块

1、安装包下载
地址:https://nginx.org/download/

2、上传至Ubuntu中并解压缩
tar -zxvf nginx-1.16.1.tar.gz

nginx编译安装需要先安装pcre、openssl、zlib等库。也可以直接编译执行下面的configure命令,
根据错误提示信息,安装相应缺少的库即可。

下面的make命令会向系统路径拷贝文件,需要在root用户下执行

sudo ./configure -with-stream
sudo make && make install

编译完成后,默认安装在了/usr/local/aginx目录。

cd /usr/local/nginx

在这里插入图片描述

可执行文件在sbin目录里面,配置文件在conf日录里面。

sudo vim ./conf/nginx.conf
sudo ./sbin/nginx -s reload#重读conf
sudo ./sbin/nginx#启动

2. nginx的tcp负载配置

在bash中使用

sudo netstat -tanp

查看当前tcp连接情况
在这里插入图片描述
安装的nginx默认会启动监听,要注意一下他们的端口位置
在events与http之间添加tcp的配置,如下:


#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;
}# nginx tcp loadbalance config
stream {upstream MyServer {server 127.0.0.1:6000 weight=1 max_fails=3 fail_timeout=30s;server 127.0.0.1:6002 weight=1 max_fails=3 fail_timeout=30s;}server {proxy_connect_timeout 1s;#proxy_timeout 3s;listen 8080;proxy_pass MyServer;tcp_nodelay on;}
}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       90;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;}}

其中,tcp部分为

# nginx tcp loadbalance config
stream { #这里的端口指向的是服务器端口upstream MyServer { #要添加多少个服务器,就在下面开放多少个端口server 127.0.0.1:6000 weight=1 max_fails=3 fail_timeout=30s;server 127.0.0.1:6002 weight=1 max_fails=3 fail_timeout=30s;}server {proxy_connect_timeout 1s; #设置代理连接超时时间#proxy_timeout 3s;listen 8080;	#监听端口,客户端连接此端口即可,nginx自动处理分配消息给服务器proxy_pass MyServer;	#代理的名字tcp_nodelay on;	}
}

客户端只需连接nginx配置的监听端口,即可与服务器进行通信
在这里插入图片描述

在这里插入图片描述


文章转载自:

http://niJBClU0.zxgzp.cn
http://33GijL6Q.zxgzp.cn
http://8Jna4lk4.zxgzp.cn
http://1aE7YnFb.zxgzp.cn
http://1uYPzaaS.zxgzp.cn
http://k90ee4kV.zxgzp.cn
http://qcAvDSQb.zxgzp.cn
http://ITThuag6.zxgzp.cn
http://x7QQD8kS.zxgzp.cn
http://dO3UX0uQ.zxgzp.cn
http://JBZM1cfJ.zxgzp.cn
http://2OKYeSP6.zxgzp.cn
http://l2iO87FA.zxgzp.cn
http://YzH2cZH0.zxgzp.cn
http://zssDQbx4.zxgzp.cn
http://qMkhcTnM.zxgzp.cn
http://7dgTqQ16.zxgzp.cn
http://iKK55Oqg.zxgzp.cn
http://QcxNWlHa.zxgzp.cn
http://ih6xE6Rs.zxgzp.cn
http://RxCSj5h7.zxgzp.cn
http://F39cVIzT.zxgzp.cn
http://rx7wSIzm.zxgzp.cn
http://EeEETeWI.zxgzp.cn
http://Rij4dIc6.zxgzp.cn
http://EFQ22YsM.zxgzp.cn
http://ZoEyZF26.zxgzp.cn
http://u6aZ5rM2.zxgzp.cn
http://Po6taJv9.zxgzp.cn
http://EVyF4s2s.zxgzp.cn
http://www.dtcms.com/wzjs/690393.html

相关文章:

  • 娱乐类网站怎么建设能源与动力工程
  • 网站例子wordpress 默认播放器
  • 互联网网站商标it外包服务提供商有哪些
  • 口碑好的邯郸网站建设自己做的网站加载不出验证码
  • asp.net 网站计数器wordpress上传漏洞
  • 网站建设优化多少钱ie 常用网站
  • 淄博网站建设优化公司wordpress 连接qq视频
  • 金华专业网站建设公司河池网站推广
  • 想找人做网站昆山网络推广公司
  • 辽宁省交通建设投资集团官方网站上海史特信息技术有限公司
  • 做网站和论坛区别企业vi设计策划公司企业vi设计公司
  • 住房与城乡建设部网站商丘网吧什么时候恢复营业
  • 龙岗网站建设网站制作百度统计app
  • 去年做哪个网站能致富logo免费制作平台
  • 建设交通人才网站如何编辑网站标题栏
  • 网站常见结构有那些网站建设极地网
  • H5 网站网络水果有哪些网站可以做
  • 沈阳百度网站排名互联网保险上市公司
  • 深圳网站制作比较好公司wordpress获取作者的权限
  • 资源共享网站开发wordpress visual composer主题
  • 网站这么设置微信支付宝wordpress同步qq空间
  • 十堰专业网站建设公司运营管理方案
  • 学校网站建设解决方案河北省住房城乡建设厅网站
  • 用wex5 网站开发中国核工业华兴建设有限公司
  • 合肥网站建设制作价格优秀个人网页设计案例分析
  • 百度站长拼多多刷销量网站开发
  • 网站域名注册人查询哪家公司做企业网站稳定优惠
  • 怎么建设一个电影资源网站解析微信推广方案
  • 购物网站开发公司免费建立网站论坛
  • 网站开发哈尔滨网站开发公司电话国内贸易平台