skywalking9.3.0部署

环境准备:

JDK8(安装步骤省略)

skywalking9.3.0

skywalking-java-agent-8.9.0

elasticsearch-7.17.9

下载:

curl -O https://archive.apache.org/dist/skywalking/9.3.0/apache-skywalking-apm-9.3.0.tar.gz

curl -O https://archive.apache.org/dist/skywalking/java-agent/8.9.0/apache-skywalking-java-agent-8.9.0.tgz

curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.9-linux-x86_64.tar.gz

安装es

tar -zxvf elasticsearch-7.17.9-linux-x86_64.tar.gz

#修改配置
vi config/elasticsearch.yml
 
node.name: node-1
network.host: 127.0.0.1

#以es用户启动
groupadd es
useradd es -g es -p es
chown -R es:es /data/elasticsearch-7.17.9
su es

#启动
cd /data/elasticsearch-7.17.9/bin
./elasticsearch -d

安装skywalking

tar -zxvf apache-skywalking-apm-9.3.0.tar.gz


vi config/application.yml

#修改

storage:
  selector: ${SW_STORAGE:elasticsearch}
  elasticsearch:
    namespace: ${SW_NAMESPACE:""}
    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:127.0.0.1:9200}



#启动,默认端口8080
./bin/startup.sh

安装skywalking-agent

tar -zxvf apache-skywalking-java-agent-8.9.0.tgz


vi config/agent.config

#配置sql显示的最大字数
# If set to positive number, the `db.statement` would be truncated to this length, otherwise it would be completely saved, which may cause performance problem.
plugin.jdbc.sql_body_max_length=${SW_PLUGIN_JDBC_SQL_BODY_MAX_LENGTH:20480}

配置要监控的服务

java -javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=xxx -Dskywalking.collector.backend_service=172.17.1.68:11800 -jar xxx.jar

添加maven包


        
            org.apache.skywalking
            apm-toolkit-logback-1.x
            8.15.0
        
        
            org.apache.skywalking
            apm-toolkit-trace
            8.15.0
        

配置springboot日志文件

#修改logback-spring.xml

#添加


#在想看到链路追踪id的地方加上 [%tid] 即可,比如:


        
            %d{yyyy-MM-dd HH:mm:ss.SSS} [%tid] [%thread] %-5level %logger{50} - %msg%n
        
   

启动项目可以看到,日志已经带上了tid

复制tid,粘贴到skywalking ui,即可看到本次链路

skywalking9.3.0部署_第1张图片

你可能感兴趣的:(skywalking,java,spring,boot)