In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the method of using nginx to do tcp/udp Load Balancer". In daily operation, I believe many people have doubts about the method of using nginx to do tcp/udp Load Balancer. The editor consulted all kinds of information and sorted out simple and easy operation methods. I hope to answer your doubts about "the method of using nginx to do tcp/udp Load Balancer"! Next, please follow the small series to learn together!
Goal: Load Balancer for non-http traffic
Optional technology: nginx + docker-compose,,,
Process:
Load tcp/udp traffic needs to be rebuilt nginx, the original official website is built with the --with-stream, so I found several Dockerfiles with parameters, most of which are articles from six months and a year ago, mirroring is not the focus, and debugging is time-consuming and laborious. It's better to find an officially built version directly, and it's not too late to build your own mirror after Load Balancer testing.
Search docker hub, nginx default image does not have--with-stream parameter, also did not find similar extension tag, continue to search docker nginx --with-stream
Finally found openrest, the default dockerfile with this parameter, the final docker-compose.yml is as follows
version: "3"services: openresty: image: openresty/openresty volumes: - ./ conf/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf - ./ var/run/openresty/:/var/run/openresty/ ports: - "0.0.0.0:8888:8888"
Add port payload content similar to the following format to nginx.conf
stream { server { listen 8888 ; proxy_timeout 20s; proxy_pass 192.168.1.101:8888; } server { listen 8899 udp reuseport; proxy_timeout 20s; proxy_pass 192.168.1.101:8899; }}
Execute docker-compose up -d in the directory containing the docker-compose.yml file
Check to see if the host port is up and testing the connection
At this point, the study of "using nginx to do tcp/udp Load Balancer" is over, I hope to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
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.