Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Nginx provide load balancing for Skywalking

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how Nginx provides load balancing for Skywalking". In daily operation, I believe many people have doubts about how Nginx provides load balancing for Skywalking. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how Nginx provides load balancing for Skywalking"! Next, please follow the editor to study!

Apache Skywalking is an excellent distributed link tracking system and APM system, but the problem of client load is not taken into account in the implementation of the community. Because the community already has many mature solutions for gRPC proxies (the Agent probe in Skywalking communicates with the back end mainly through gRPC).

Therefore, if it is a virtual machine or general container (non-Kubernetes platform) deployment, in order to achieve Skywalking OAP load balancing, you need to do a layer of reverse proxy. After consulting the information on the Internet, it is found that Nginx already supports the gRPC agent. On March 17, 2018, NGINIX officially announced that gRPC will be supported in nginx 1.13.10, which indicates that NGINX has completed its native support for gRPC. As we all know, gRPC is already the de facto standard RPC framework for the new generation of micro services. For implementation, service framework and other means can be used to achieve load balancing, but there is no very mature reverse proxy software for gRPC in the industry. NGINIX supports gRPC as an established load balancer software. It has been able to proxy the TCP connection of gRPC before. After the new version, it can also terminate, check and track gRPC method calls:

Publish gRPC services and then use NGINX to apply HTTP/2 TLS encryption, rate limiting, IP-based access control lists, and logging

Multiple gRPC services are published through a single endpoint, using NGINX to check and track calls to each internal service

Use Round Robin, Least Connections or other methods to allocate calls in the cluster to load balance the gRPC service cluster

Inserting NGINX between client and server applications provides a stable and reliable gateway for server applications.

Using Docker containers to build NGINX Server

Use the official docker image provided by Nginx to build server:

$docker pull nginx:1.13.101.13.10: Pulling from library/nginx2a72cbf407d6: Pull completefefa2faca81f: Pull complete080aeede8114: Pull completeDigest: sha256:c4ee0ecb376636258447e1d8effb56c09c75fe7acf756bf7c13efadf38aa0acaStatus: Downloaded newer image for nginx:1.13.10Nginx gRPC configuration

Nginx uses a HTTP server to monitor gRPC traffic and uses grpc_pass instructions to proxy traffic. Create the following proxy configuration for Nginx to listen for unencrypted gRPC traffic on port 80 and forward requests to the server on port 11800.

Grpc_proxy.conf file:

Upstream grpcservers {server 10.15.160.1 http2; location; # Skywalking OAP backend 11800 address} server {listen 80 http2; location / {grpc_pass grpc://grpcservers; error_page 502 = / error502grpc;} location = / error502grpc {internal; default_type application/grpc; add_header grpc-status 14; add_header grpc-message "unavailable"; return }} launch Nginx container docker run-- name mynginx4grpc-p 80:80-v tmp4myworkspace:/etc/nginx/conf.d:ro-d nginx:1.17

The above Nginx configuration file is located in the tmp4myworkspace directory.

At this point, the study on "how Nginx provides load balancing for Skywalking" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report