如果存储类型不是内联存储,对于 zipkin 依赖关系图,您必须启动单独的 cron 作业/调度程序,它读取存储数据库并构建图。因为 zipkin 依赖项是单独的 spark 作业。供参考:https ://github.com/openzipkin/docker-zipkin-dependencies
我使用带有弹性搜索的 zipkin 作为存储类型。我将分享使用弹性搜索和 cron 作业设置 zipkin 依赖项的步骤:
1.cd ~/
2. curl -sSL https://zipkin.io/quickstart.sh | bash -s io.zipkin.dependencies:zipkin-dependencies:LATEST zipkin-dependencies.jar
3. touch cron.sh or vi cron.sh
4. paste this content :
STORAGE_TYPE=elasticsearch ES_HOSTS=https:172.0.0.1:9200 ES_HTTP_LOGGING=BASIC ES_NODES_WAN_ONLY=true java -jar zipkin-dependencies.jar
5.chmode a+x cron.sh //make file executable
6.crontab -e
window will open paste below content
0 * * * * cd && ./cron.sh //every one hour it will start the cron job if you need every 5 minutes change the commmand to '*/5 * * * * cd && ./cron.sh'
7. to check cron job is schedule run commant crontab -l
其他解决方案是启动一个单独的服务并使用 docker 运行 cron 作业
获取最新 zipkin-dependencies jar 的步骤尝试在终端上运行给定的命令
cd /zipkindependencies // where your Dockerfile is available
curl -sSL https://zipkin.io/quickstart.sh | bash -s io.zipkin.dependencies:zipkin-dependencies:LATEST
您将在上述目录中获得 jar 文件
Dockerfile
FROM openjdk:8-jre-alpine
ENV STORAGE_TYPE=elasticsearch
ENV ES_HOSTS=http://172.0.0.1:9200
ENV ES_NODES_WAN_ONLY=true
ADD crontab.txt /crontab.txt
ADD script.sh /script.sh
COPY entry.sh /entry.sh
COPY zipkin-dependencies.jar /
RUN chmod a+x /script.sh /entry.sh
RUN /usr/bin/crontab /crontab.txt
CMD ["/entry.sh"]
EXPOSE 8080
入口.sh
#!/bin/sh
# start cron
/usr/sbin/crond -f -l 8
脚本.sh
#!/bin/sh
java ${JAVA_OPTS} -jar /zipkin-dependencies.jar
crontab.txt
0 * * * * /script.sh >> /var/log/script.log