最后的话
最近很多小伙伴找我要Linux学习资料,于是我翻箱倒柜,整理了一些优质资源,涵盖视频、电子书、PPT等共享给大家!
资料预览
给大家整理的视频资料:
给大家整理的电子书资料:
如果本文对你有帮助,欢迎点赞、收藏、转发给朋友,让我有持续创作的动力!
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
Nginx 流量镜像配置
upstream bd_interface {
server 10.1.1.1:8080;
check interval=3000 rise=2 fall=5 timeout=2000 type=http;
check_http_send "HEAD / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx http_4xx;
}
#镜像流量也可以负载均衡
upstream mirror_interface1 {
server 10.2.1.1:9090;
check interval=3000 rise=2 fall=5 timeout=2000 type=http;
check_http_send "HEAD / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx http_4xx;
}
#镜像流量也可以负载均衡
upstream mirror_interface2 {
server 10.3.1.1:9090;
check interval=3000 rise=2 fall=5 timeout=2000 type=http;
check_http_send "HEAD / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx http_4xx;
}
server {
listen 80;
server_name xxx;
access_log logs/bd-interface.log access_json;
charset utf8;
client_max_body_size 800M;
gzip on;
gzip_min_length 5k;
gzip_comp_level 8;
gzip_types application/javascript text/css text/javascript image/jpeg image/gif image/png application/json;
proxy_read_timeout 600s;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
location / {
mirror /mirror1;
mirror /mirror2; #两份镜像
mirror_request_body on;
proxy_http_version 1.1;
proxy_pass http://bd_interface;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 20;
proxy_read_timeout 1000;
proxy_send_timeout 300;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
}
location /mirror1 {
internal; #只有内部请求可以调用
proxy_pass http://127.0.0.1:10991$request_uri; #配置镜像日志,mirror本身不支持日志
proxy_set_header X-Original-URI $request_uri;
}
location /mirror2 {
internal; #只有内部请求可以调用
proxy_pass http://127.0.0.1:10992$request_uri; #配置镜像日志,mirror本身不支持日志
proxy_set_header X-Original-URI $request_uri;
}
#状态监控
location /nginx_status {
stub_status on;
access_log off;
}
#状态监控
location /check_status {
check_status;
access_log off;
}
}
server {
listen 10992;
server_name 127.0.0.1;
client_max_body_size 800M;
proxy_read_timeout 600s;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
access_log logs/bd-interface.log access_json;
location / {
proxy_http_version 1.1; #流量和并发大时必须使用http1.1
proxy_pass http://mirror_interface2;
}
}
server {
listen 10991;
server_name 127.0.0.1;
client_max_body_size 800M;
proxy_read_timeout 600s;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
access_log logs/bd-interface.log access_json;
location / {
proxy_http_version 1.1;#流量和并发大时必须使用http1.1
proxy_pass http://mirror_interface1;
}
}
Nginx流量拷贝的注意事项
mirror_request_body/proxy_pass_request_body与Content-Length需配置一致。如果mirror_request_body
或者proxy_pass_request_body
设置为 off
,则Content-Length
必须设置为""
,因为nginx(mirror_request_body)
或tomcat(mirror_request_body)
处理post请求时,会根据Content-Length
获取请求体,如果Content-Length
不为空,而由于mirror_request_body
或者proxy_pass_request_body
设置为off
,处理方以为post有内容,当request_body
中没有,处理方会一直等待至超时。mirror_request_body
为off
,nginx
会报upstream
请求超时;proxy_pass_request_body
为off,tomcat会报异常。
参考文章
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
需要这份系统化的资料的朋友,可以点击这里获取!](https://bbs.csdn.net/topics/618635766)**
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!