如果监控系统用的是Prometheus Grafana,那么链路监控可以使用Grafana家族产品Grafana Tempo,但部署比较麻烦,涉及组件较多,文章可以参考《Grafana,Loki,Tempo,Prometheus,Agent搭建日志链路监控平台》,如果只需要简单的监控 链路跟踪,我觉得使用Skywalking是一个好选择
1、部署ES
Docker 启动用户要是 elasticsearch 单机要配置discovery.type=single-node 开启集群内访问9200
代码语言:javascript复制docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node"
--name='elasticsearch'
-d elasticsearch:8.7.0
elasticsearch.yml 配置文件
代码语言:javascript复制network.host: 0.0.0.0
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 08-04-2023 18:34:05
#
# --------------------------------------------------------------------------------
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: false
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
ES重置密码
代码语言:javascript复制elasticsearch-reset-password -u elastic
如果没有权限报不能使用root启动
,使用如下命令创建新用户,使用该用户启动
groupadd es
useradd es -g es -p password # -g 指定组 -p 密码
2、部署Skywalking
部署skywalking-oap-server
开启集群内访问 12800
代码语言:javascript复制docker run -d --name skywalking-oap-server
-p 12800:12800 -p 11800:11800
-v /Users/chenjujun/sdk/skywalking/application.yml:/skywalking/config/application.yml
-v /Users/chenjujun/sdk/skywalking/alarm-settings.yml:/skywalking/config/alarm-settings.yml
apache/skywalking-oap-server:9.4.0
或者使用 容器名引用ES地址:
代码语言:javascript复制docker run -d --name skywalking-oap-server
-p 12800:12800 -p 11800:11800
--link elasticsearch:elasticsearch
-e SW_STORAGE=elasticsearch -e SW_STORAGE_ES_CLUSTER_NODES=elasticsearch:9200
-v /Users/chenjujun/sdk/skywalking/application.yml:/skywalking/config/application.yml
-v /Users/chenjujun/sdk/skywalking/alarm-settings.yml:/skywalking/config/alarm-settings.yml
apache/skywalking-oap-server:9.4.0
application.yml 配置调整
alarm-settings.yml配置调整
部署skywalking-ui
需要配置OAP 地址
代码语言:javascript复制docker run -d --name skywalking-ui
-p 8088:8080
-e SW_OAP_ADDRESS=http://10.247.181.214:12800
apache/skywalking-ui:9.4.0
Agent 设置
代码语言:javascript复制-javaagent:/Users/chenjujun/Downloads/skywalking-agent/skywalking-agent.jar
-Dskywalking.agent.service_name=phantom-gateway-open
-Dskywalking.collector.backend_service=127.0.0.1:11800
附录
1、基于Docker部署Skywalking https://blog.csdn.net/qq_31279701/article/details/124191651 2、GitHub: elastic/elasticsearch 3、Skywalking:https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-setup/ 4、JavaAgent 地址: https://archive.apache.org/dist/skywalking/java-agent/