zipkin 安装及配置
zipkin 安装配置
1.1 服务端 安装及运行
# 安装
curl -sSL https://zipkin.io/quickstart.sh | bash -s
# 运行
java -jar zipkin.jar
1.2 配置修改
建立 startup.sh 文件
与zipkin.jar 在同一个目录下。
内容如下:
#!/usr/bin/env bash
# DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SOURCE="${BASH_SOURCE[0]}"
while [[ -h "$SOURCE" ]]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ ${SOURCE} != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd ${DIR}
# export HTTP_COLLECTOR_ENABLED=true
export STORAGE_TYPE=elasticsearch
# elasticsearch 配置 不用可屏蔽
export ES_HOSTS=http://xxx.xxx.xxx.xxx:9200
export ES_INDEX=zipkin
export ES_INDEX_SHARDS=1
export ES_INDEX_REPLICAS=0
export ES_USERNAME=elastic
export ES_PASSWORD=elastic
# http收集
export HTTP_COLLECTOR_ENABLED=true
# mq 配置 不用可屏蔽
export RABBIT_ADDRESSES=xxx.xxx.xxx.xxx:5672
export RABBIT_USER=admin
export RABBIT_PASSWORD=admin
export RABBIT_QUEUE=zipkin
export RABBIT_VIRTUAL_HOST=infrastructure
export JAVA_OPTS="-Xms1024m -Xmx1024m"
1.2 客户端
1.2.1 maven配置
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
1.2.2 application.yml配置
spring:
application:
name: test-1
sleuth:
web:
client:
enabled: true
sampler:
probability: 1.0 # 将采样比例设置为 1.0,也就是全部都需要。默认是 0.1
zipkin:
base-url: http://xxx.xxx.xxx.xxx:9411/ # 指定了 Zipkin 服务器的地址
rabbitmq:
queue: zipkin
rabbitmq:
host: 10.2.100.11
port: 5672
username: admin
password: admin
virtual-host: infrastructure
publisher-confirms: true
#connection-timeout: 1000ms
template:
retry:
enabled: true
listener:
simple:
acknowledge-mode: auto
server:
port: 8088