skywalking链路追踪(es数据源)+调用链忽略

elasticsearch安装

1、根目录下新建data文件夹

2、修改elasticsearch.yml文件,添加以下内容

path.data: /home/elk/elasticsearch-8.13.4/data
path.logs: /home/elk/elasticsearch-8.13.4/logs
​
xpack.security.enabled: false  #关闭xpack安全认证,视情况配置

3、修改jvm.options文件,新增以下内容

-Xms2g
-Xmx2g

4、启动

bin/elasticsearch 前台启动
bin/elasticsearch -d 后台启动

5、初始密码

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Elasticsearch security features have been automatically configured!
✅ Authentication is enabled and cluster connections are encrypted.
​
ℹ️  Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
  qP3wO0GZ+pdomIp_ShHL
​
ℹ️  HTTP CA certificate SHA-256 fingerprint:
  98aef4ebc491b232a4c1cbf1cbfe7b73e1e4ebb8567caa174097f5c69f2b41fd
​
ℹ️  Configure Kibana to use this cluster:
• Run Kibana and click the configuration link in the terminal when Kibana starts.
• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
  eyJ2ZXIiOiI4LjEzLjQiLCJhZHIiOlsiMTk5Ljk5LjAuMTo5MjAwIl0sImZnciI6Ijk4YWVmNGViYzQ5MWIyMzJhNGMxY2JmMWNiZmU3YjczZTFlNGViYjg1NjdjYWExNzQwOTdmNWM2OWYyYjQxZmQiLCJrZXkiOiJmcF9ES3BBQlR6c3lRM0RMSU4teDoxclFRLXZraFREYUdYZmNiN2pQbXBBIn0=
​
ℹ️  Configure other nodes to join this cluster:
• On this node:
  ⁃ Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`.
  ⁃ Uncomment the transport.host setting at the end of config/elasticsearch.yml.
  ⁃ Restart Elasticsearch.
• On other nodes:
  ⁃ Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

6、修改密码

# 重置密码
bin/elasticsearch-reset-password --username elastic -i

启动脚本

#!/bin/bash
#chkconfig: 345 63 37
#description: elasticsearch
#processname: elasticsearch-7.10.2
​
# 这个目录是你Es所在文件夹的目录
export ES_HOME=/home/tomcat/elk/elasticsearch-8.13.4
case $1 in
start)
    cd $ES_HOME
    ./bin/elasticsearch -d -p pid
    exit
!
    echo "elasticsearch is started"
    ;;
stop)
    pid=`cat $ES_HOME/pid`
    kill -9 $pid
    echo "elasticsearch is stopped"
    ;;
restart)
    pid=`cat $ES_HOME/pid`
    kill -9 $pid
    echo "elasticsearch is stopped"
    sleep 1
    cd $ES_HOME
    ./bin/elasticsearch -d -p pid
    exit
!
    echo "elasticsearch is started"
    ;;
*)
    echo "start|stop|restart"
    ;;
esac
exit 0

skywalking链路追踪

apache-skywalking-apm-bin

1、数据源配置修改

vim apache-skywalking-apm-bin/config/application.yml

 

 修改内容如下

storage:
  selector: ${SW_STORAGE:elasticsearch}
  elasticsearch:
    namespace: ${SW_NAMESPACE:"elasticsearch"}
    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:192.168.1.223:9200}
    protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"http"}
    connectTimeout: ${SW_STORAGE_ES_CONNECT_TIMEOUT:3000}
    socketTimeout: ${SW_STORAGE_ES_SOCKET_TIMEOUT:30000}
    responseTimeout: ${SW_STORAGE_ES_RESPONSE_TIMEOUT:15000}
    numHttpClientThread: ${SW_STORAGE_ES_NUM_HTTP_CLIENT_THREAD:0}
    user: ${SW_ES_USER:"elastic"}
    password: ${SW_ES_PASSWORD:"elastic"}

2、端口修改

vim apache-skywalking-apm-bin/webapp/application.yml

 

修改内容如下

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#web端访问端口
serverPort: ${SW_SERVER_PORT:-8088}

# Comma seperated list of OAP addresses.
oapServices: ${SW_OAP_ADDRESS:-http://localhost:12800}

zipkinServices: ${SW_ZIPKIN_ADDRESS:-http://localhost:9412}

3、启动

apache-skywalking-apm-bin/bin/webappService.sh

 

skywalking-agent

1、调用链忽略(取消跟踪)

将optional-plugins\apm-trace-ignore-plugin-8.3.0.jar复制到plugins下。

在config下面新建一个配置文件 apm-trace-ignore-plugin.config,文件内容如下

trace.ignore_path=Redisson/**,Mysql/**

 

2、jar包启动

java -javaagent:/usr/local/skywalking/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=app1 -jar app1.jar

3、docker+jar包启动(将skywalking构建在镜像中)

dockerfile

FROM eclipse-temurin:21-jre

## 创建目录,并使用它作为工作目录
RUN mkdir -p /app
WORKDIR /app
## 将后端项目的 Jar 文件,复制到镜像中
COPY target/app.jar app.jar

## 设置 TZ 时区
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m"

## 暴露后端项目的 8080端口
EXPOSE 8080

ENV SKYWALKING_AGENT_SERVICE_NAME="app"
ENV SKYWALKING_COLLECTOR_BACKEND_SERVICE="192.168.1.223:11800"
COPY  skywalking-agent /usr/local/agent
ENTRYPOINT [ "sh", "-c", "java ${JAVA_OPTS} -javaagent:/usr/local/agent/skywalking-agent.jar -Dskywalking.agent.service_name=$SKYWALKING_AGENT_SERVICE_NAME -Dskywalking.collector.backend_service=$SKYWALKING_COLLECTOR_BACKEND_SERVICE -Djava.security.egd=file:/dev/./urandom -jar app.jar" ]

 

4、构建docker镜像

docker build -t xaws-system:5.0.0.4 -f system/dockerfile .

 

posted @ 2024-09-04 14:13  特昂糖-  阅读(297)  评论(0)    收藏  举报