码迷,mamicode.com
首页 > 其他好文 > 详细

将请求分发至同一主机的不同端口(不考虑容器)

时间:2020-06-30 13:06:50      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:python3   agent   pst   headers   rem   aot   使用情况   connect   nal   

 

解决的问题:
将请求分发至同一主机的不同端口(不考虑容器)

支持:
https


upstream api {
  server 127.0.0.1:5000 weight=1;
  server 127.0.0.1:5001 weight=1;
  server 127.0.0.1:5002 weight=1;
}
server {

  server_name paper.com;

  location / {

    proxy_pass http://api;
    proxy_ssl_certificate /etc/letsencrypt/live/paper.com/fullchain.pem; # managed by Certbot
    proxy_ssl_certificate_key /etc/letsencrypt/live/paper.com/privkey.pem; # managed by Certbot
  }

  listen 443 ssl; # managed by Certbot
  ssl_certificate /etc/letsencrypt/live/paper.com/fullchain.pem; # managed by Certbot
  ssl_certificate_key /etc/letsencrypt/live/paper.com/privkey.pem; # managed by Certbot
  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}




(base) paper@kn:~# ps -ef | grep py
paper       463     1  0 Jun28 ?        00:00:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
paper       561     1  0 Jun28 ?        00:00:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
paper      2594  2484  0 Jun28 ?        00:00:18 /usr/bin/python2 /usr/bin/supervisord -n -c /etc/supervisord.conf
paper     17314     1  0 Jun29 ?        00:00:00 python3 manage.py runserver 0.0.0.0:5000
paper     17552 17314  4 Jun29 ?        00:47:04 /paper/anaconda3/bin/python3 manage.py runserver 127.0.0.1:5000
paper     23970     1  0 10:05 ?        00:00:00 python3 manage.py runserver 0.0.0.0:5001
paper     23973 23970  7 10:05 ?        00:02:18 /paper/anaconda3/bin/python3 manage.py runserver 0.0.0.0:5001
paper     24076     1  0 10:06 ?        00:00:00 python3 manage.py runserver 0.0.0.0:5002
paper     24079 24076  9 10:06 ?        00:02:44 /paper/anaconda3/bin/python3 manage.py runserver 0.0.0.0:5002
paper     24515 24393  0 10:36 pts/4    00:00:00 grep --color=auto py

 

检查端口使用情况

1、压测的限流告警

throttled X-API-VERSION[:9]:2.0.14.58;request.X-REQUEST-ID[:36]:c17caf67-2ab7-4bec-8776-14d36c50ef45;request.META[:567]:{‘REQUEST_METHOD‘: ‘GET‘, ‘QUERY_STRING‘: ‘‘, ‘SCRIPT_NAME‘: ‘‘, ‘PATH_INFO‘: ‘/api/test/news/list/‘, ‘wsgi.multithread‘: True, ‘wsgi.multiprocess‘: True, ‘REMOTE_ADDR‘: ‘127.0.0.1‘, ‘REMOTE_HOST‘: ‘127.0.0.1‘, ‘REMOTE_PORT‘: 57490, ‘SERVER_NAME‘: ‘127.0.0.1‘, ‘SERVER_PORT‘: ‘5002‘, ‘HTTP_HOST‘: ‘api.jubaotime.com‘, ‘HTTP_REMOTE_HOST‘: ‘121.35.100.120‘, ‘HTTP_X_FORWARDED_FOR‘: ‘121.35.100.120‘, ‘HTTP_X_FORWARDED_PROTO‘: ‘https‘, ‘HTTP_X_REAL_IP‘: ‘121.35.100.120‘, ‘HTTP_CONNECTION‘: ‘upgrade‘, ‘HTTP_USER_AGENT‘: ‘Apache-HttpClient/4.5.12 (Java/15-ea)‘};request.headers[:240]:{‘Host‘: ‘api.jubaotime.com‘, ‘Remote-Host‘: ‘121.35.100.120‘, ‘X-Forwarded-For‘: ‘121.35.100.120‘, ‘X-Forwarded-Proto‘: ‘https‘, ‘X-Real-Ip‘: ‘121.35.100.120‘, ‘Connection‘: ‘upgrade‘, ‘User-Agent‘: ‘Apache-HttpClient/4.5.12 (Java/15-ea)‘};request.body[:3]:b‘‘throttle_limit:128throttle_window_second:32

 

将请求分发至同一主机的不同端口(不考虑容器)

标签:python3   agent   pst   headers   rem   aot   使用情况   connect   nal   

原文地址:https://www.cnblogs.com/rsapaper/p/13212509.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!