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 to realize the Fast Construction of SkyWalking

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how to achieve the rapid construction of SkyWalking, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Set up SkyWalking and download SkyWalking

Download SkyWalking APM from the official website and select the corresponding version.

Download it and decompress it.

Configuration database

Skywalking supports h3, mysql and ElasticSearch as data storage, and ElasticSearch is officially recommended.

According to the specific business, the most convenient H3 database is used for data storage. H3 is included with Skywalking and is an in-memory database. Memory data will be lost due to service failure and restart, which is not suitable for long-term monitoring scenarios, so it needs to be changed to a file database.

Open the apache-skywalking-apm-es7-8.4.0\ apache-skywalking-apm-bin-es7\ config\ application.yml file and modify the url address of the h3 node.

Url: ${SW_STORAGE_H2_URL:jdbc:h3:tcp://127.0.0.1/~/skywalking-oap-db;AUTO_SERVER=TRUE}

Start h3 TCP

H3 file database needs to start H3 TCP, otherwise Skywalking will fail to start because it cannot listen to port 9092.

How linux starts h3 TCP:

Create a new startup script and run it. After startup, the database file skywalking-oap-db is automatically created in the user directory (such as administrator or root or home/user).

The linux script is as follows

#! / usr/bin/env sh PRG= "$0" PRGDIR= `dirname "$PRG" `[- z "$OAP_HOME"] & & OAP_HOME= `cd "$PRGDIR/.." > / dev/null; pwd`OAP_LOG_DIR= "${OAP_HOME} / logs" JAVA_OPTS= "- Xms64M-Xmx256M" if [!-d "${OAP_HOME} / logs"] Then mkdir-p "${OAP_LOG_DIR}" fi _ RUNJAVA=$ {JAVA_HOME} / bin/java [- z "$JAVA_HOME"] & & _ RUNJAVA=java CLASSPATH= "$OAP_HOME/config:$CLASSPATH" for i in "$OAP_HOME" / oap-libs/h3*.jardo CLASSPATH= "$i:$CLASSPATH" done OAP_OPTIONS= "- Doap.logDir=$ {OAP_LOG_DIR}" # if remote connection to h3 database is required Change-tcp to-tcpAllowOtherseval exec "\\" $_ RUNJAVA\\ "${JAVA_OPTS} ${OAP_OPTIONS}-classpath $CLASSPATH org.h3.tools.Server-tcp\\ 2 > ${OAP_LOG_DIR} / h3Tcp.log 1 > / dev/null &" if [$?-eq 0] Then sleep 1 echo "SkyWalking h3Tcp started successfully!"else echo" SkyWalking h3Tcp started failure! " Exit 1fi

How windows starts h3 TCP:

Create a new startup script and run it. The windows script is as follows

@ REM if you need to view the h3 database remotely (tcp port 9092, page access port 8082), change-tcp to-tcpAllowOthers @ echo off setlocalset OAP_PROCESS_TITLE=Skywalking-H2TcpServerset OAP_HOME=%~dp0%..set OAP_OPTS= "- Xms64M-Xmx256M-Doap.logDir=%OAP_HOME%\\ logs" set CLASSPATH=%OAP_HOME%\\ config;.;set CLASSPATH=%OAP_HOME%\\ oap-libs\\ * % CLASSPATH% if defined JAVA_HOME (set _ EXECJAVA= "% JAVA_HOME%\\ bin\\ java") if not defined JAVA_HOME (echo "JAVA_HOME not set." Set _ EXECJAVA=java) start "% OAP_PROCESS_TITLE%"% _ EXECJAVA% "% OAP_OPTS%"-cp "% CLASSPATH%" org.h3.tools.Server-tcpendlocal

Set up Java Agent

Java Agent is a Java probe and is an argument to the java command. When the virtual machine starts, before executing the main method, you will find the javaagent command to specify the jar package and execute the preman () method in premain-class.

The settings are as follows:

Copy the apache-skywalking-apm-es7-8.4.0\ apache-skywalking-apm-bin-es7\ agent file to the monitoring target server, and then add parameters to the startup command:

The windows parameters are as follows:

Set SW_AGENT_NAME=eda-app-base-serviceset SW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.0.24:11800set JAVA_TOOL_OPTIONS=-javaagent:E:\\ tech\\ agent\\ skywalking-agent.jar

SW_AGENT_NAME: set service name

SW_AGENT_COLLECTOR_BACKEND_SERVICES: backend collector port and address, set to SkyWalking server IP:11800 (default port)

Skywalking-agent.jar location under the JAVA_TOOL_OPTIONS:agent folder

The Linux parameters are as follows:

# SkyWalking Agent configuration export SW_AGENT_NAME=demo-application # configure Agent name. In general, we directly use the `spring.application.name` of the Spring Boot project. Export SW_AGENT_COLLECTOR_BACKEND_SERVICES=127.0.0.1:11800 # configure the Collector address. Export SW_AGENT_SPAN_LIMIT=2000 # configures the maximum number of Span for the link. In general, no configuration is required, and the default is 300. The main consideration is that for some new SkyWalking Agent projects, the code may be bad. Export JAVA_AGENT=-javaagent:/Users/yunai/skywalking/apache-skywalking-apm-bin-es7/agent/skywalking-agent.jar # SkyWalking Agent jar address. # Jar starts java-jar $JAVA_AGENT-jar lab-39-demo-2.2.2.RELEASE.jar

Specific variables may vary from version to version (version 8.4.0 of this article). More variables can be found in agent\ config\ agent.config.

Start up and run

Start h3 TCP first

Start apache-skywalking-apm-es7-8.4.0\ apache-skywalking-apm-bin-es7\ bin\ startup.bat, and it will start both Skywalking-Webapp and Skywalking-Collector services.

Start business services

Visit http://127.0.0.1:8080 and you can see the SkyWalking interface.

If port 8080 is occupied, you can modify the port through the apache-skywalking-apm-es7-8.4.0\ apache-skywalking-apm-bin-es7\ webapp\ webapp.yml file.

The above is how to achieve the rapid construction of SkyWalking, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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