zoukankan      html  css  js  c++  java
  • 【Mysql】SpringBoot_2.1.0+Druid_1.1.10 配置数据源监控服务Yml格式

    访问地址:localhost:8080/druid

    按照这个方法和版本配置没问题

    版本或高或低可能会出现不兼容

    1、添加依赖

    <dependency>
         <groupId>com.alibaba</groupId>
         <artifactId>druid-spring-boot-starter</artifactId>
         <version>1.1.10</version>
    </dependency>
     <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.1.0.RELEASE</version>
     </parent>

    2、配置yml

    spring:
      datasource:
        url: 
        username: root
        password:
        type: com.alibaba.druid.pool.DruidDataSource
        druid:
          # 下面为连接池的补充设置,应用到上面所有数据源中
          # 初始化大小,最小,最大
          initial-size: 5
          min-idle: 5
          max-active: 20
          # 配置获取连接等待超时的时间
          max-wait: 60000
          # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
          time-between-eviction-runs-millis: 60000
          # 配置一个连接在池中最小生存的时间,单位是毫秒
          min-evictable-idle-time-millis: 300000
          validation-query: SELECT 1 FROM DUAL
          test-while-idle: true
          test-on-borrow: false
          test-on-return: false
          # 打开PSCache,并且指定每个连接上PSCache的大小
          pool-prepared-statements: true
          #   配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
          max-pool-prepared-statement-per-connection-size: 20
          filters: stat,wall
          use-global-data-source-stat: true
          # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
          connect-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
          # 配置监控服务器
          stat-view-servlet:
            login-username: admin
            login-password: 123456
            reset-enable: false
            url-pattern: /druid/*
            # 添加IP白名单
            #allow:
            # 添加IP黑名单,当白名单和黑名单重复时,黑名单优先级更高
            #deny:
          web-stat-filter:
            # 添加过滤规则
            url-pattern: /*
            # 忽略过滤格式
            exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
  • 相关阅读:
    windows的80端口被占用时的处理方法
    Ansible自动化运维工具安装与使用实例
    Tomcat的测试网页换成自己项目首页
    LeetCode 219. Contains Duplicate II
    LeetCode Contest 177
    LeetCode 217. Contains Duplicate
    LeetCode 216. Combination Sum III(DFS)
    LeetCode 215. Kth Largest Element in an Array(排序)
    Contest 176 LeetCode 1354. Construct Target Array With Multiple Sums(优先队列,递推)
    Contest 176
  • 原文地址:https://www.cnblogs.com/itworkers/p/12622308.html
Copyright © 2011-2022 走看看