Zipkin 是一个开放源代码分布式的跟踪系统,每个服务向zipkin报告计时数据,zipkin会根据调用关系通过Zipkin UI生成依赖关系图。
安装 Zipkin + MySQL
1. 添加数据库
添加数据库zipkin
导入初始化sql脚本在:https://github.com/openzipkin/zipkin/blob/master/zipkin-storage/mysql-v1/src/main/resources/mysql.sql
2. 安装 zipkin + docker-compose + mysql
mkdir /home/zipkin
cd /home/zipkin
vi docker-compose.yml
添加下面代码
version: '2'
services:
zipkin:
image: openzipkin/zipkin:2.23.16
container_name: zipkin
restart: always
environment:
- TZ=Asia/Shanghai
- STORAGE_TYPE=mysql
- MYSQL_DB=zipkin
- MYSQL_USER=root
- MYSQL_PASS=root
- MYSQL_HOST=10.176.11.128
- MYSQL_TCP_PORT=3306
ports:
- 9411:9411
3. 启动 docker-compose up -d
4. 查看日志 docker-compose logs -f
安装Zipkin + Elasticsearch
1. 创建文件夹
mkdir -p /usr/local/zipkin/
cd /usr/local/zipkin/
2. 编写compose文件
vi docker-compose.yml
3. 添加内容
version: '3.8'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.1
container_name: elasticsearch
restart: always
ports:
- 9200:9200
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- TZ=Asia/Shanghai
ulimits:
memlock:
soft: -1
hard: -1
zipkin:
image: openzipkin/zipkin:2.23.16
container_name: zipkin
depends_on:
- elasticsearch
links:
- elasticsearch
restart: always
ports:
- 9411:9411
environment:
- TZ=Asia/Shanghai
- STORAGE_TYPE=elasticsearch
- ES_HOSTS=elasticsearch:9200
4. 启动
docker-compose up -d
5. 查看日志
docker-compose logs -f
网友评论