码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • actuator--基础--03--端点配置


    actuator–基础–03–端点配置


    1、默认暴露

    在这里插入图片描述

    1. 上图配置JMX和HTTP的暴露端点。
    2. Actuator 默认只会开放 /actuator/health 和 /actuator/info这两个端点,如果要开放其他 endpoint,需要额外在 application.properties 中做设置。

    2、暴露配置(application.properties)

    # 暴露所有 HTTP的endpoints(不包含shutdown)
    #management.endpoints.web.exposure.include=*
    
    # 只暴露指定 HTTP的endpoint
    # 这里只暴露 /actuator/beans和/actuator/mappings 端点
    #management.endpoints.web.exposure.include=beans,mappings
    
    ## exclude 用来关闭某些endpoints
    ## exclude 通常会跟include一起用,先include全部endpoints,然后再exclude某些endpoints 
    # 这里暴露所有的端点中,排除/actuator/beans这个端点
    management.endpoints.web.exposure.exclude=beans
    management.endpoints.web.exposure.include=*
    
    # 如果要开启/actuator/shutdown,要额外再加这一行
    management.endpoint.shutdown.enabled=true
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    3、路径映射(application.properties)

    3.1、公共路径

    1. 默认情况下所有端点都暴露在"/actuator"路径下
    2. 通过修改application.properties来自定义路径映射
    # 原本內建的/actuator/xxx路径,都会变成/manage/xxx,可以用來防止被其他人猜到
    management.endpoints.web.base-path=/manage
     
    
    
    • 1
    • 2
    • 3
    • 4

    3.2、特定路径

    1. 这里以/actuator/health作为案例
      1. 默认情况,健康检查暴露在"/actuator/health"路径下
    2. 通过修改application.properties来自定义路径映射
      
    # 原本內建的/actuator/health路径, 会变成/actuator/healthcheck,可以用來防止被其他人猜到
    management.endpoints.web.path-mapping.health=healthcheck
    
    
    • 1
    • 2
    • 3
    • 4

    4、管理端口调整(application.properties)

    # 指定端口,默认跟server.port一样,可以防止被其他人猜到
    management.server.port=10111
    
    • 1
    • 2

    5、端点响应缓存(application.properties)

    对于一些不带参数的端点请求会自动进行缓存,我们可以通过如下方式配置缓存时间

    # 下面配置表示 beans 端点的缓存时间为 100s 
    management.endpoint.beans.cache.time-to-live=100s
    
    
    • 1
    • 2
    • 3

    6、设置访问的IP(application.properties)

    # 设置为本地ip,防止远程访问该连接进行关闭服务
    # 不允许远程管理连接,安全性考虑
    management.server.address=127.0.0.1
    
    • 1
    • 2
    • 3
  • 相关阅读:
    蓝牙核心规范(V5.4)10.10-BLE 入门笔记之SMP和安全性
    Linux网络编程系列之服务器编程——阻塞IO模型
    【Vue】Vue的部分语法规则
    reids基础数据结构
    异形双柱体阵列纳米粒:针状/花状纳米粒子/纳米金星/金笼/金壳/三角形纳米金
    centos7 部署oracle完整教程(命令行)
    《自动驾驶感知算法实战专栏(源代码)》专栏概述 | 实战教程,开放源码
    12、IOC 之基于 Java 的容器配置
    android webview加载第三方网页,<select>控件无法弹出的问题
    jsp JSTL标签详细示例(c:if与c:forEach)
  • 原文地址:https://blog.csdn.net/zhou920786312/article/details/126860966
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号