In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
[TOC]
Build SkyWalking service (For ElasticSearch 7)
Reference for the basic use of SkyWalking:
Implementation of Service Link tracking based on SkyWalking
Official documents:
Chinese version of SkyWalking documents (provided by the community) Apache SkyWalking official documents download package
First of all, we need to get the download address of SkyWalking. The official download address is as follows:
Http://skywalking.apache.org/downloads/
Here I choose the latest 6.6.0 binary package. Since the version of es service that needs to be interfaced later is 7.x, we have to choose for ElasticSearch 7:
Copy the download address to the server to download and decompress. The specific steps are as follows:
[root@localhost ~] # cd / usr/local/src [root@localhost / usr/local/src] # wget http://mirror.bit.edu.cn/apache/skywalking/6.6.0/apache-skywalking-apm-es7-6.6.0.tar.gz[root@localhost / usr/local/src] # mkdir.. / skywalking & & tar-zxvf apache-skywalking-apm-es7-6.6.0.tar.gz-C.. / skywalking--strip-components 1 [root@ Localhost / usr/local/src] # cd.. / skywalking/ [root@localhost / usr/local/skywalking] # ll-rh # the extracted directory file is as follows: total 88Kdrwxr-xr-x 2 root root 53 Dec 28 18:22 webapp-rw-rw-r-- 1 1001 1002 2.0K Dec 24 14:10 README.txtdrwxrwxr-x 2 1002 12K Dec 24 14:28 oap-libs-rwxrwxr-x 1 1001 1002 32K Dec 24 14:10 NOTICEdrwxrwxr-x 3 1001 1002 4.0K Dec 28 18:22 licenses-rwxrwxr-x 1 1001 1002 29K Dec 24 14:10 LICENSEdrwxr-xr-x 2 root root Dec 28 18:22 configdrwxr-xr-x 2 root root Dec 28 18:22 bindrwxrwxr-x 8 1001 1002 Dec 24 14:21 agent [root@localhost / usr/local/skywalking] # configuration
The composition of SkyWalking is logically divided into four parts: probe, platform backend, storage and user interface. The platform backend service is used to collect monitoring data uploaded by agent, and its core configuration file is located at: config/application.yml.
If there are no requirements, you can basically start the SkyWalking service directly without modifying the configuration. However, there is usually a persistent requirement for monitoring data online, and SkyWalking uses H2 as an in-memory database by default, which does not have the feature of persistent storage. So we need to modify its storage configuration and access the elasticsearch service as a storage component.
First configure the default H2 database to comment out:
[root@ip-236-048 skywalking] # vim config/application.yml# h3 driver: ${SW_STORAGE_H2_DRIVER:org.h3.jdbcx.JdbcDataSource} # url: ${SW_STORAGE_H2_URL:jdbc:h3:mem:skywalking-oap-db} # user: ${SW_STORAGE_H2_USER:sa} # metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}
Then uncomment the elasticsearch7 configuration and modify it as follows:
Storage: elasticsearch7: # nameSpace: ${SW_NAMESPACE: ""} clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:192.168.3.10:9200} protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL: "http"} # trustStorePath: ${SW_SW_STORAGE_ES_SSL_JKS_PATH: ".. / es_keystore.jks"} # trustStorePass: ${SW_SW_STORAGE_ES_SSL_JKS_PASS: "" } # user: ${SW_ES_USER: "} # password: ${SW_ES_PASSWORD:"} indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2} indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0} # Those data TTL settings will override the same settings in core module. RecordDataTTL: ${SW_STORAGE_ES_RECORD_DATA_TTL:7} # Unit is day otherMetricsDataTTL: ${SW_STORAGE_ES_OTHER_METRIC_DATA_TTL:45} # Unit is day monthMetricsDataTTL: ${SW_STORAGE_ES_MONTH_METRIC_DATA_TTL:18} # Unit is month # Batch process setting Refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:1000} # Execute the bulk every 1000 requests flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests resultWindowMaxSize: $ {SW_STORAGE_ES_QUERY_MAX_WINDOW_SIZE:10000} metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000} segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200} advanced: ${SW_STORAGE_ES_ADVANCED: ""}
Another common requirement is to modify the listening ip and port number. Skywalking defaults to 12800 as the rest api communication port and 11800 to the gRPC api communication port. These can be modified in the configuration file, but I keep the default here:
Core: default: # Mixed: Receive agent data, Level 1 aggregate, Level 2 aggregate # Receiver: Receive agent data Level 1 aggregate # Aggregator: Level 2 aggregate role: ${SW_CORE_ROLE:Mixed} # Mixed/Receiver/Aggregator restHost: ${SW_CORE_REST_HOST:0.0.0.0} restPort: ${SW_CORE_REST_PORT:12800} restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/} gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0} gRPCPort: ${SW_CORE_GRPC_ PORT:11800} for other configuration items, please see the official documentation to run.
After the above configuration is completed, run the startup.sh script in the bin directory to start the skywalking service:
[root@localhost / usr/local/skywalking] # bin/startup.shSkyWalking OAP started successfully!SkyWalking Web Application started successfully! [root@localhost / usr/local/skywalking] #
The SkyWalking console service listens to port 8080 by default. If there is a firewall, the port needs to be opened:
[root@localhost / usr/local/skywalking] # firewall-cmd-zone=public-add-port=8080/tcp-permanentsuccess [root@localhost / usr/local/skywalking] # firewall-cmd-reloadsuccess [root@localhost / usr/local/skywalking] #
If you want to allow remote transmission, you also need to open ports 11800 (gRPC) and 12800 (rest), through which the remote agent transmits the collected data:
[root@localhost / usr/local/skywalking] # firewall-cmd-zone=public-add-port=11800/tcp-permanentsuccess [root@localhost / usr/local/skywalking] # firewall-cmd-zone=public-add-port=12800/tcp-permanentsuccess [root@localhost / usr/local/skywalking] # firewall-cmd-reloadsuccess [root@localhost / usr/local/skywalking] #
After the normal startup is successful, use the browser to visit the home page as follows:
Tips: if skywalking is connecting to the elasticsearch service for the first time, it will be slow to start because skywalking needs to create a lot of index to the es service. So access to this page will be blank until the creation is complete. At this point, you can check the log to determine whether the startup is complete. Log path: logs/skywalking-oap-server.log uses
Next, integrate the java agent probe for the project to see if skywalking can properly monitor the data. Start by creating two simple Spring Cloud projects, consumer and producer:
Both projects contain basic component dependencies: nacos-discovery, openfeign, and web. Because SkyWalking collects and uploads data through Java agent, a language probe, there is no need to add additional dependencies and configurations like zipkin.
Consumer will invoke the interface provided by producer to achieve the effect of a simple call link shown later on SkyWalking. Therefore, write an interface in producer with the following code:
@ Slf4j@RestController@RequestMapping ("/ producer") public class ProducerController {@ GetMapping public String producer () {log.info ("received a request"); return "this message from producer";}}
Consumer also has an interface, which is the interface that calls producer. The code is as follows:
@ Slf4j@RestController@RequiredArgsConstructor@RequestMapping ("/ consumer") public class ConsumerController {private final ProducerClient producerClient; @ GetMapping public String consumer () {log.info ("consumer something"); / / call String result = producerClient.producer () through feign; return "consumer:" + result;}}
The ProducerClient code is as follows:
FeignClient ("producer") public interface ProducerClient {@ GetMapping ("/ producer") String producer ();}
Since you need to use the Java Agent jar package provided by SkyWalking for local debugging, you can download the compressed package for the corresponding platform from the previous download page:
The contents of the extracted directory file are as follows:
We mainly use the jar package under the agent directory:
For convenience, there is no need to copy a separate agent directory for each service. Override the configuration item by adding JVM startup parameters:
# specify the jar package path of javaagent-javaagent:E:\ skywalking\ apache-skywalking-apm-bin\ agent\ skywalking-agent.jar# specifies the service name of skywalking agent, usually corresponding to the service name of the project-Dskywalking.agent.service_name=consumer# specifies the connection ip and port number-Dskywalking.collector.backend_service=192.168.10.6:11800 of the skywalking backend platform collection service
After completing the above steps, set the JVM startup parameters in the configuration interface of the boot class in IDEA. As follows:
The producer service is also configured as shown above. Just change the name of the service.
Start two projects respectively, and then access the / consumer interface:
At this point, go to the monitoring page of SkyWalking, go to the "tracking" page, and select the correct time range, and you can see the link tracking information for this interface:
Other featur
Service Topology Diagram:
Service Monitoring:
Service instance monitoring:
Endpoint monitoring:
If the project successfully integrates agent, but still finds that there is no data on the monitoring page and no error message in the log, it is likely that the time range is not selected correctly:
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.