spring cloud 整合 zipkin-server 日志监控

試著忘記壹切 提交于 2020-02-25 18:31:34

1.  pom.xml 加入

	    <!--zipkin-->
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-server</artifactId>
            <version>2.12.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
    				<artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-autoconfigure-ui</artifactId>
            <version>2.12.3</version>
        </dependency>
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-autoconfigure-collector-kafka</artifactId>
            <version>2.12.9</version>
        </dependency>
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-autoconfigure-storage-elasticsearch-http</artifactId>
            <version>2.8.4</version>
        </dependency>
        <!--www.1b23.com-->

2. application.properties 配置文件

spring.application.name=fhcloud-zipkin-server
server.port=8003

#开启安全认证 用户名和密码
spring.security.basic.enabled=true
spring.security.user.name=admin
spring.security.user.password=root

#指向注册中心
eureka.instance.leaseRenewalIntervalInSeconds=10
eureka.client.registryFetchIntervalSeconds=5
eureka.client.serviceUrl.defaultZone=http://127.0.0.1:8761/eureka/,http://127.0.0.1:8762/eureka/

#actuator配置
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=env,beans
management.security.enabled=false

management.metrics.web.server.auto-time-requests=fals

3. 启动类 FHmainApplication.java

package org.fh;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

import zipkin2.server.internal.EnableZipkinServer;

/**
 * 说明:启动类 
 * www.1b23.com
 */
@SpringBootApplication
@EnableEurekaClient
@EnableZipkinServer
public class FHmainApplication {

	public static void main(String[] args) {
		SpringApplication.run(FHmainApplication.class, args);
	}
	
}

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!