title: 微服务集成SkyWalking
date: 2019-11-24 09:59:21
categories:
- 微服务
tags: - SkyWalking
最近做的一个项目使用了Spring Cloud Alibaba,随着服务系统的增多,调用连也越来越复杂,好几天不碰,就有点忘了,所以想集成一个APM系统进来,没想到遇到很多坑,边学习边记录,最开始学习netflix那一套的时候,玩过zipkin,觉得界面有点丑。。。想到SkyWalking是国人写的,文档多点,就尝试了下。
架构
SkyWalking的架构图就不偷了,它主要分成4大模块,这些模块也是我们需要安装的。
Agent
(客户端收集器):使用 JavaAgent 做字节码植入,无侵入式的收集,并通过 HTTP 或者 gRPC 方式发送数据到 SkyWalking Collector。Oap
(服务端分析):链路数据收集器,对 agent 传过来的数据进行整合分析处理并落入相关的数据存储中。Storage
(存储): SkyWalking 的存储,Mysql、ES、H2存储介质进行数据存储。UI
:Web 可视化平台,用来展示落地的数据。
安装
使用官方的docker镜像部署,docker-compose文件
# 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.
version: '3.3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.3
container_name: elasticsearch
restart: always
ports:
- 9201:9200
- 9301:9300
environment:
discovery.type: single-node
TZ: Asia/Shanghai
ulimits:
memlock:
soft: -1
hard: -1
oap:
image: apache/skywalking-oap-server
container_name: oap
depends_on:
- elasticsearch
links:
- elasticsearch
restart: always
ports:
- 11800:11800
- 12800:12800
environment:
SW_STORAGE: elasticsearch
SW_STORAGE_ES_CLUSTER_NODES: 10.0.12.4:9201
TZ: Asia/Shanghai
ui:
image: apache/skywalking-ui
container_name: ui
depends_on:
- oap
links:
- oap
restart: always
ports:
- 8480:8080
environment:
SW_OAP_ADRESS: 11.0.12.4:12800
TZ: Asia/Shangha