preface

Skywalking is a distributed system application performance monitoring, distributed link tracking tool, with cloud, Borui and a series of server monitoring component services similar, open source related similar components zipkin, Pinpoint, etc., because the author’s project team is preparing to upgrade SpringCloud, There is a lack of relevant link monitoring components, and zipkin is related to springcloud1.0. Therefore, skywalking is temporarily selected for investigation and construction. Currently, the latest version of SkyWalking is 6.4. In this blog example, NACOS is used as the registry and SpringCloudGateway is used as the gateway for forwarding service requests.

The body of the

Skywalking architecture

As shown in the figure below, the whole is mainly divided into three parts:

  1. Skywalk-agent: probe added when the monitored service is started to collect and push data to the collector and send data to the Collector component via gRPC;
  2. Skywalk-collector: a link data collector that receives and processes data sent by the agent. Data can be saved in H2, ElasticSearch, mysql, etc.
  3. Skywalking – Web: visual management background of the Web, echo the persistent data and display the collected data.

Build skywalking

The various service versions used in the construction are as follows:

nacos elasticsearch skywalking springcloudgateway
1.1.3 6.4.2 6.4.0 Greenwich.SR1

Before building, download the corresponding version of the package, and ensure that the corresponding port is not occupied, 8848 (NACOS), 9200 (ES), 8080 (Skywalking -web), 11800, 12800.

The construction is divided into the following steps: 1. 2. The ES configuration is started. 3. Skywalk-collector and Skywalk-Web configuration start; 4. Start skywalk-agent and service.

1. Start nacOS first. See nacos. IO /zh-cn/docs/… , local access http://localhost:8848/nacos can see management page.

2. Configure and start es, modify es configuration, and set the node name, host address, and port in the es directory config/ elasticSearch. yml as follows:

Cluster. name: CollectorDBCluster node.name: CollectorDBCluster net. host: 127.0.0.1 http.port: 9200Copy the code

/ elasticSearch -d: The ES service is running properly./ ElasticSearch -d: the ES service is running properly.

{
name: "CollectorDBCluster",
cluster_name: "CollectorDBCluster",
cluster_uuid: "NuJtMyOnShun26UWoXCQXw",
version: {
number: "6.4.2",
build_flavor: "default",
build_type: "tar",
build_hash: "04711c2",
build_date: "The 2018-09-26 T13:34:09. 098244 z",
build_snapshot: false,
lucene_version: "7.4.0",
minimum_wire_compatibility_version: "5.6.0",
minimum_index_compatibility_version: "5.0.0"
},
tagline: "You Know, for Search"
}
Copy the code

3. Then prepare to start Skywalking, first modify skywalking configuration, config/application.yml as follows:

Register to the NACOS configuration
cluster:
  nacos:
    serviceName: ${SW_SERVICE_NAME:"SkyWalking_OAP_Cluster"}
    # Nacos cluster nodes, example: 10.0.0.1:8848,10.0. 0.2:8848,10.0. 0.3:8848
    hostPort: ${SW_CLUSTER_NACOS_HOST_PORT:localhost:8848}

Select es for nameSpace configuration and comment out H2. If you choose to use H2, no changes are requiredStorage: ElasticSearch: nameSpace: CollectorDBCluster clusterNodes: 127.0.0.1:9200 indexShardsNumber: 2Copy the code

To change the skywalk-Web port number, you need to change webapp/webapp.yml.

Then start Skywalking. For Linux, run the./startup.sh command in the Skywalking bin directory, and for Windows, run startup.bat. At this point we should be able to see nacos console (http://localhost:8848/nacos) in the list of service have SkyWalking_OAP_Cluster skywalking registration such as list, And access to the Skywalking console (http://localhost:8080/).

4. Start agent in skywalking directory with corresponding project service. Such as Java – javaagent: / software/skywalking/agent/skywalking – agent. The jar – Dskywalking. Agent. The service_name = demo – Dskywalking. Collector. Backend_service = 127.0.0.1:11800 demo. Jar if it is in the idea or eclipse to start the project, In the VM OPTIONS of project startup, to increase the parameter – javaagent: / software/skywalking/agent/skywalking – agent. The jar – Dskywalking. Agent. The service_name = demo – Dskywalking. Collector. Backend_service = 127.0.0.1:11800

The above – Dskywalking. Agent. Service_name refers to the service name registered to skywalking, And – Dskywalking. Collector. Backend_service skywalking receiving agent is sending data service and port. After the two services are started, you can see the registered two services and the invocation chain in the background and topology, as shown in the following figure.

conclusion

Skywalking + NacOS + ElasticSearch + Demo-service was built by skywalking+ NacOS + ElasticSearch + Demo-service. I encountered many problems during this process, such as version compatibility, Skywalking bugs, careless configuration errors, etc. I didn’t pay much attention to official documentation at the beginning. The follow-up correction will be completed after comparing with official documents. I hope to communicate with you more.

Reference: www.cnblogs.com/jackion5/p/…

Blog.csdn.net/dpnice/arti…

Github.com/apache/skyw…