Goal: non-http traffic load balancing
alternative techniques: nginx + docker-compose ,,,,
process:
load tcp / udp traffic need to rebuild what nginx, the official website of the original is built with the --with-stream, so look for Dockerfile several arguments, mostly half a year before the article, hit the mirror is not the point, and time-consuming to debug. Still I thought it best to go directly to build a good official version, load balancing test and then build your own mirror too late.
In docker hub to find a moment, nginx default image parameters without the --with-stream, but could not find a similar extension tag, continue to search docker nginx --with-stream
eventually find openresty, default dockerfile took this argument, the final docker-compose.yml follows
Version: "www.sanguoyoux.cn"
Services:
openresty:
Image: openresty / openresty
Volumes:
- ./conf/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf
- ./var/run/openresty/: www.rhyl158.com / var / RUN / openresty /
the ports:
- "0.0.0.0:www.jintianxuesha.com 8888: 8888"
In nginx.conf added, the load port similar to the following format content
Stream {
Server {
the listen 8888;
proxy_timeout 20S;
proxy_pass 192.168.1.101:8888;
}
Server {www.xinxingyuLep.cn
the listen UDP reuseport 8899;
proxy_timeout 20S;
proxy_pass 192.168.1.101 : 8899;
Docker-compose.yml executed in the directory containing the file under docker-compose up -d
to see if the host port has been started, test the connection
- end
the National Day holiday at home can not use k8s cluster test, can not use a key to install a variety of chart a. All local virtual machine will open up another book fan runaway, temperature and noise, not very friendly.
Since then research docker-compose, before this has been ignored gadget with them actually quite sweet.
If you experience problems try messages, learning together