在使用Zipkin之前,保证已安装好docker和Docker Compose工具
使用vi命令创建docker-compose.yml文件
vi docker-compose.yml
编辑内容如下:
version: '2'
services:
# The zipkin process services the UI, and also exposes a POST endpoint that
# instrumentation can send trace data to. Scribe is disabled by default.
zipkin:
image: openzipkin/zipkin
container_name: zipkin
environment:
- STORAGE_TYPE=mysql
- MYSQL_DB=zipkin
- MYSQL_HOST=192.168.31.136
- MYSQL_USER=root
- MYSQL_PASS=123456
- MYSQL_TCP_PORT=3306
# Uncomment to enable scribe
#- SCRIBE_ENABLED=true
# Uncomment to enable self-tracing
#- SELF_TRACING_ENABLED=true
# Uncomment to enable debug logging
#- JAVA_OPTS=-Dlogging.level.zipkin=DEBUG -Dlogging.level.zipkin2=DEBUG
ports:
# Port used for the Zipkin UI and HTTP Api
- 9411:9411
# Uncomment if you set SCRIBE_ENABLED=true
# - 9410:9410
restart: unless-stopped
在此文件中我们使用mysql作为数据存储容器,修改mysql连接地址和用户,然后开始构建docker容器
docker-compose up -d
然后打开浏览器,访问:
http://0.0.0.0:9411
打开后,等待10s左右,如果提示以下错误
ERROR: cannot load service names: java.sql.SQLNonTransientConnectionException: (type=master) : Host is unreachable (Host unreachable)
则说明无法连接数据库,若数据库配置信息没有问题,并且能正常访问,说明有防火墙存在,不妨关闭防火墙试试可不可以访问
systemctl stop firewalld