常用配置application.yml

server:
  port: 3000
spring:
#  environment: dev
  application:
    name: rw # 服务名称
  main:
    allow-bean-definition-overriding: true
  cloud:
    nacos:
      username: user
      password: pwd
    discovery:
      server-addr: ip:8848      # Nacos地址
      namespace: '${spring.environment}'   # 命名空间ID,用作环境隔离,服务注册在哪个命名空间
      cluster-name: HZ     # 集群名称
      # ephemeral: false # 设置为非临时实例
    config:
      server-addr: ip:8848    # Nacos地址
      #file-extension: yml     # 文件后缀名
      group: DEFAULT_GROUP
      namespace: '${spring.environment}'  # 命名空间ID,用作在哪个空间查找 user-service.yaml、user-service-sit.yaml 文件
      extension-configs:           # 多服务间共享的配置列表
        - dataId: app-common.yaml      # 本服务要读取的共享配置文件名称
  redis:
    database: 0  # Redis数据库索引(默认为0)
    timeout: 60000  # 连接超时时间(毫秒)
    password: pwd
    host: ip
    port: 6379
    lettuce:
      shutdown-timeout: 100    # 毫秒
      pool:
        min-idle: 5    # 连接池中的最小空闲连接
        max-active: 5000  # 连接池最大连接数(使用负值表示没有限制)
        max-idle: 10  # 连接池中的最大空闲连接
        max-wait: 1000   # 连接池最大阻塞等待时间(使用负值表示没有限制):毫秒
  cache:
    redis:
      time-to-live: 1800000     # 缓存默认有效时长,以毫秒为单位
    type: redis    #指定使用redis作为缓存
  datasource:
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://ip:3306/reggie?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
      username: root
      password: admin
      type: com.alibaba.druid.pool.DruidDataSource

  shardingsphere:
    props:
      sql:
        show: true  # 开启sql显示,默认为false
    sharding:
      default-data-source-name: master
    masterslave:
      # 最终数据源名称
      name: ms
      # 主库数据源名称
      master-data-source-name: master
      # 从库数据源名称列表,多个逗号分割
      slave-data-source-names: slave
      load-balance-algorithm-type: rounde_robin   # slave节点负载均衡策略,采用轮询
    datasource:
      names: master,slave
      master:
        type: com.alibaba.druid.pool.DruidDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://ip:3306/itcast?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
        username: root
        password: admin
        initialSize: 5
        minIdle: 5
        maxPoolSize: 20
        minPoolSize: 5
        maxWait: 60000
      slave:
        type: com.alibaba.druid.pool.DruidDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://1ip:3306/itcast?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
        username: root
        password: admin
        maxPoolSize: 20
        minPoolSize: 5
        initialSize: 5
        minIdle: 5
        maxWait: 60000

mybatis-plus:
  configuration:
    #在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射  实体类属性名:idNumber -> 数据库字段名:id_number
    map-underscore-to-camel-case: true
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  global-config:
    db-config:
      id-type: AUTO
      table-prefix: tb_

SMS:
  sendSms: false
  verification:
    regionId: cn-hangzhou
    accessKeyId:
    secret: 
    sign_name: 
    template_code:

posted @ 2023-01-13 14:14  DeyouKong  阅读(215)  评论(0编辑  收藏  举报