Collector Naming Server in SkyWalking
Overview
The Collector Naming Server in SkyWalking is a crucial component that provides a naming service for the Collector Agent Server. This article will delve into the details of the Collector Naming Server, including its architecture, implementation, and configuration.
Collector Naming Server
The Collector Naming Server is implemented through the apm-collector-naming project, which defines the interface of the Naming Server. The collector-naming-define project provides the interface definition, while the collector-naming-jetty-provider project implements the Jetty-based Naming Server.
Naming Module
The NamingModule is an abstract class that realizes the module abstract class ClusterModule. It provides two methods:
#name(): Returns the module name, which is “naming”.#services(): Returns the Service class name, which isNamingHandlerRegisterService.
Naming Module Jetty Provider
The NamingModuleJettyProvider is a concrete implementation of the ModuleProvider abstract class. It provides three methods:
#name(): Returns the component service provider name, which is “jetty”.#module(): Returns the component class, which isNamingModule.#requiredModules(): Returns the dependent components, which areClusterModuleandJettyManagerModule.
Naming Handler Register Service
The NamingHandlerRegisterService is an interface that provides a registration service processor. It has a single method:
#register(ServerHandler): Registers a ServerHandler instance.
Naming Jetty Handler Register Service
The NamingJettyHandlerRegisterService is a concrete implementation of the NamingHandlerRegisterService interface. It provides a registration method that calls the JettyManagerService#addHandler(path, registration) method to register a Jetty Server request handler.
Agent Jetty Naming Handler
The AgentJettyNamingHandler is a concrete implementation of the JettyHandler abstract class. It provides two methods:
#pathSpec(): Returns the request path, which is “/agent/jetty”.#doGet(): Calls theAgentJettyNamingListener#getAddresses()method to obtain the Collector Agent Jetty Server cluster address.
Agent GRPC Naming Handler
The AgentGRPCNamingHandler is a concrete implementation of the JettyHandler abstract class. It provides two methods:
#pathSpec(): Returns the request path, which is “/agent/gRPC”.#doGet(): Calls theAgentGRPCNamingListener#getAddresses()method to obtain the Collector Agent gRPC Server cluster address.
Configuration Files
The Collector Naming Server configuration files are as follows:
- The Naming Server starts at port 10800.
- The Collector Server is embedded in the Collector Naming Server.
- The Collector Server forms a Naming Server cluster by launching multiple nodes.
- The Naming Server Agent is configured with multiple addresses.
Collector Discovery Service
The Collector Discovery Service is implemented through the org.skywalking.apm.agent.core.remote.CollectorDiscoveryService class. It provides a BootService interface that discovers the Collector Agent Server address.
Collector Discovery Service
The CollectorDiscoveryService class implements the java.lang.Runnable interface. It provides a constructor that randomly selects a Collector Naming Server and a #findServerList() method that obtains the Collector Agent Server cluster address.
Collector Discovery Service Client
The CollectorDiscoveryServiceClient class is a concrete implementation of the java.lang.Runnable interface. It provides a constructor that randomly selects a Collector Naming Server and a #findServerList() method that obtains the Collector Agent Server cluster address.
Configuration Files
The Collector Discovery Service configuration files are as follows:
- The discovery check interval is set to 60 seconds.
- The discovery REST service client is implemented using the Apache HttpClient 4.5.3 version.