其他
springboot整合skyworking+elasticsearch实现链路追踪,接口优化没问题!
使用版本
SpringBoot | 2.1.9.RELEASE |
SkyWorking-apm | 9.3.0 |
SkyWorking-agent | 8.16.0 |
ElasticSearch | 6.2.2 |
下载地址
Skyworking | https://skywalking.apache.org/downloads/ |
ElasticSearch | https://www.elastic.co/cn/downloads/past-releases#elasticsearch |
ElasticSearch配置
解压后进入config目录,编辑elasticsearch.yml及jvm.options,分别配置如下
#集群名称
cluster.name: myEsCluster
#本机ip
network.host: 192.168.0.168
#跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
#jvm.options配置
-Xms2g
-Xmx2g
#配置cluster为standalone模式
cluster:
selector: ${SW_CLUSTER:standalone}
#配置存储为elasticsearch
storage:
selector: ${SW_STORAGE:elasticsearch}
elasticsearch:
namespace: ${SW_NAMESPACE:""}
#配置es节点
clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:192.168.0.168: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}
#配置es用户及密码,默认为空
user: ${SW_ES_USER:""}
password: ${SW_ES_PASSWORD:""}
.....
#配置skyworking访问web的端口号
serverPort: ${SW_SERVER_PORT:-8080}
#配置config目录下application.yml中的core.restHost的端口
oapServices: ${SW_OAP_ADDRESS:-http://localhost:12800}
应用接入Skyworking
此时我本地有两个业务模块:study-biz、study-tenant,分别在启动配置上新增
外卖领神卷,天天有优惠