SpringBootAdmin小记

SpringBootAdmin据说是把actuator暴露的信息综合展示出来,

给我的感觉就是一刀88级。

以下内容抄自Github上的官方文档--------2.0.5版本

3.客户端配置

3.1 展示版本信息

官网说如果是spring-boot程序,打包时加上如下代码,会自动生成META-INF/build-info.properties



<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

非spring-boot自己看官方文档

效果如下:

3.4 打标记

官方说可以用下面2种方式:

#using the metadata
spring.boot.admin.client.instance.metadata.tags.environment=test

#using the info endpoint
info.tags.environment="队长别开枪,是我"

但是,我测试了只有第2种有效,效果如下

3.5 Spring Boot Admin Client

3.5.1Spring Boot Admin Client 可选配置

属性名称描述默认值
spring.boot.admin.client.enabled是否允许 Spring Boot Admin Clienttrue
spring.boot.admin.client.url强制让Spring Boot Admin Server 注册的URL,以逗号分隔 
spring.boot.admin.client.api-path在admin server中注册的endpoint"instances"
spring.boot.admin.client.username
spring.boot.admin.client.password
SBA Server的授权用户和密码 
spring.boot.admin.client.period反复注册的间隔(ms)10,000
spring.boot.admin.client.connect-timeout注册连接超时(ms)5,000
spring.boot.admin.client.read-timeout注册读取超时(ms)5,000
spring.boot.admin.client.auto-registration如果设置成true将会在client启动之后自动进行周期注册任务true
spring.boot.admin.client.auto-deregistration是否允许自动解除注册的开关,后面的英文看不懂=.=!

null

spring.boot.admin.client.register-once如果设置为true,那么会按照spring.boot.admin.instance.url定义的顺序只注册在第一个Server上,如果注册的Server挂了,将会自动注册到下一个上,如果设置成false那么会注册在全部Server上true
spring.boot.admin.client.instance.health-urlHealth-url to register with. Can be overridden in case the reachable URL is different (e.g. Docker). Must be unique in registry.management-url and endpoints.health.id.
spring.boot.admin.client.instance.management-base-urlBase url for computing the management-url to register with. The path is inferred at runtime, and appended to the base url.Guessed based on management.port, service-url and server.servlet-path.
spring.boot.admin.client.instance.management-urlManagement-url to register with. Can be overridden in case the reachable url is different (e.g. Docker).Guessed based on management-base-url and management.context-path.
spring.boot.admin.client.instance.service-base-urlBase url for computing the service-url to register with. The path is inferred at runtime, and appended to the base url.Guessed based on hostname, server.port.

spring.boot.admin.client.instance.service-url

服务的URL

Guessed based on service-base-url and server.context-path.

spring.boot.admin.client.instance.name

注册的名字

${spring.application.name:spring-boot-application}

spring.boot.admin.client.instance.prefer-ip

Use the ip-address rather then the hostname in the guessed urls. If server.address / management.address is set, it get used. Otherwise the IP address returned from InetAddress.getLocalHost() gets used.

false

spring.boot.admin.client.instance.metadata.*

与该实例 关联的元数据,以键值对的形式 

spring.boot.admin.client.instance.metadata.tags.*

与该实例 关联的标记,以键值对的形式

 

3.5.2 可选的实例元数据配置

KeyValueDefault value

user.name
user.password

Credentials being used to access the endpoints.

 

4 Spring Boot Admin Server

 Spring Boot Admin Server 可选配置

Property nameDescriptionDefault value

spring.boot.admin.context-path

入口,与Dispatcher-Servlet.关联

 

spring.boot.admin.monitor.period

更新实例状态的时间间隔(ms)

10,000

spring.boot.admin.monitor.status-lifetime

实例状态的声明周期时间(ms),在没有过期之前,Server不会重新去检测

10,000

spring.boot.admin.monitor.connect-timeout

查询实例状态信息时连接超时时间(ms)

2,000

spring.boot.admin.monitor.read-timeout

查询实例状态信息时读取超时时间(ms)

20,000

spring.boot.admin.metadata-keys-to-sanitize

当元数据的key与这些正则匹配时,value将会被转换为json类型输出

".password$", ".*secret$", ".*key$", ".$token$", ".credentials.", ".*vcap_services$"

spring.boot.admin.probed-endpoints

For Spring Boot 1.x client applications SBA probes for the specified endpoints using an OPTIONS request. If the path differs from the id you can specify this as id:path (e.g. health:ping)..

"health", "env", "metrics", "httptrace:trace", "threaddump:dump", "jolokia", "info", "logfile", "refresh", "flyway", "liquibase", "heapdump", "loggers", "auditevents"

spring.boot.admin.instance-proxy.ignored-headers

当request请求时不进行传递d

`"Cookie", "Set-Cookie", "Authorization"

spring.boot.admin.ui.brand

首页的logo的url

"<img src="assets/img/icon-spring-boot-admin.svg"><span>Spring Boot Admin</span>"

spring.boot.admin.ui.title

首页展示的logo后面的文字

"Spring Boot Admin"

电灯泡

Spring Boot Admin will only update the info and available endpoints when a application changes status or when the registration changes. If you want to trigger an update with every new deployment, you can add a key value pair that changes with every restart (e.g. eureka.instance.metadata-map.startup: ${random.int}).

当一个实例状态改变或者注册改变的时候,Spring Boot Admin 仅仅只会更新信息和有效的endpoints ,如果你想要每次重新部署时触发一次更新,那么你可以添加一个每次重启都会变动的键值对,例如:eureka.instance.metadata-map.startup: ${random.int}

4.1.3. Converting ServiceInstances

Table 4. Instance metadata options

KeyValueDefault value

user.name
user.password

Credentials being used to access the endpoints.

 

management.address

替代服务的url, 作为健康监控端点入口地址

 

management.port

替代服务的port, 作为健康监控端点入口端口 

management.context-path

追加到服务路径后面的路径,用于获取监控

${spring.boot.admin.discovery.converter.mangement-context-path}

health.path

The path is appended to the service URL and will be used for the health-checking. Ignored by the EurekaServiceInstanceConverter.

${spring.boot.admin.discovery.converter.health-endpoint}

Table 5. Discovery configuration options

Property nameDescriptionDefault value

spring.boot.admin.discovery.enabled

Enables the DiscoveryClient-support for the admin server.

true

spring.boot.admin.discovery.converter.management-context-path

Will be appended to the service-url of the discovered service when the management-url is converted by the DefaultServiceInstanceConverter.

/actuator

spring.boot.admin.discovery.converter.health-endpoint-path

Will be appended to the management-url of the discovered service when the health-url is converted by the DefaultServiceInstanceConverter.

"health"

spring.boot.admin.discovery.ignored-services

当使用服务发现时不会被注册的服务,可以用简单匹配

"foo*", "*bar", "foo*bar*"

 

spring.boot.admin.discovery.services

当使用服务发现时可以注册的服务

"*"

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值