update 更改整体配置策略 使用注册中心命名空间隔离

This commit is contained in:
疯狂的狮子Li
2022-01-10 00:48:27 +08:00
parent eb67caf507
commit 6bf7371d89
23 changed files with 1095 additions and 1218 deletions

188
config/dev/application.yml Normal file
View File

@@ -0,0 +1,188 @@
server:
# undertow 配置
undertow:
# HTTP post内容的最大大小。当值为-1时默认值为大小是无限的
max-http-post-size: -1
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
# 每块buffer的空间大小,越小的空间被利用越充分
buffer-size: 512
# 是否分配的直接内存
direct-buffers: true
threads:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
io: 8
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
worker: 256
dubbo:
application:
logger: slf4j
protocol:
# 使用dubbo协议通信
name: dubbo
# dubbo 协议端口(-1表示自增端口,从20880开始)
port: -1
# 注册中心配置
registry:
address: nacos://${spring.cloud.nacos.server-addr}
group: DUBBO_GROUP
# URL采用精简模式(与元数据中心配合)
simplified: true
# 消费者相关配置
consumer:
# 结果缓存(LRU算法)
cache: true
# 支持校验注解
validation: true
# 超时时间
timeout: 3000
# 初始化检查
check: false
scan:
# 接口实现类扫描
base-packages: com.ruoyi.**.dubbo
# 自定义配置
custom:
# 全局请求log
request-log: true
spring:
main:
allow-bean-definition-overriding: true
#jackson配置
jackson:
# 日期格式化
date-format: yyyy-MM-dd HH:mm:ss
serialization:
# 格式化输出
INDENT_OUTPUT: false
# 忽略无法转换的对象
fail_on_empty_beans: false
deserialization:
# 允许对象忽略json中不存在的属性
fail_on_unknown_properties: false
cloud:
# sentinel 配置
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: localhost:8718
# redis通用配置 子服务可以自行配置进行覆盖
redis:
host: localhost
port: 6379
password:
database: 0
timeout: 10s
ssl: false
# redisson 配置
redisson:
# 线程池数量
threads: 16
# Netty线程池数量
nettyThreads: 32
# 传输模式
transportMode: "NIO"
# 单节点配置
singleServerConfig:
# 客户端名称
clientName: ${ruoyi.name}
# 最小空闲连接数
connectionMinimumIdleSize: 32
# 连接池大小
connectionPoolSize: 64
# 连接空闲超时,单位:毫秒
idleConnectionTimeout: 10000
# 命令等待超时,单位:毫秒
timeout: 3000
# 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。
retryAttempts: 3
# 命令重试发送时间间隔,单位:毫秒
retryInterval: 1500
# 发布和订阅连接的最小空闲连接数
subscriptionConnectionMinimumIdleSize: 1
# 发布和订阅连接池大小
subscriptionConnectionPoolSize: 50
# 单个连接最大订阅数量
subscriptionsPerConnection: 5
# DNS监测时间间隔单位毫秒
dnsMonitoringInterval: 5000
# redisson 缓存配置
cacheGroup:
# 用例: @Cacheable(cacheNames="groupId", key="#XXX") 方可使用缓存组配置
- groupId: redissonCacheMap
# 组过期时间(脚本监控)
ttl: 60000
# 组最大空闲时间(脚本监控)
maxIdleTime: 60000
# 组最大长度
maxSize: 0
# 分布式锁 lock4j 全局配置
lock4j:
# 获取分布式锁超时时间,默认为 3000 毫秒
acquire-timeout: 3000
# 分布式锁的超时时间,默认为 30 毫秒
expire: 30000
# 暴露监控端点
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS
logfile:
external-file: ./logs/${spring.application.name}/console.log
# 日志配置
logging:
level:
org.springframework: warn
org.apache.dubbo: warn
com.alibaba.nacos: warn
config: classpath:logback.xml
# mybatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath:mapper/**/*.xml
# swagger配置
swagger:
license: Powered By ruoyi
licenseUrl: https://ruoyi.vip
# seata配置
seata:
# 默认关闭如需启用spring.datasource.dynami.seata需要同时开启
enabled: false
# Seata 应用编号,默认为 ${spring.application.name}
application-id: ${spring.application.name}
# Seata 事务组编号,用于 TC 集群名
tx-service-group: ${spring.application.name}-group
# 服务配置项
service:
# 虚拟组和分组的映射
vgroup-mapping:
${spring.application.name}: default
config:
type: nacos
nacos:
serverAddr: ${spring.cloud.nacos.server-addr}
group: SEATA_GROUP
namespace:
registry:
type: nacos
nacos:
application: seata-server
server-addr: ${spring.cloud.nacos.server-addr}
namespace:

41
config/dev/datasource.yml Normal file
View File

@@ -0,0 +1,41 @@
datasource:
system-master:
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能
url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username: root
password: password
gen:
url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username: root
password: password
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
dynamic:
# 性能分析插件(有性能损耗 不建议生产环境使用)
p6spy: false
# 开启seata代理开启后默认每个数据源都代理如果某个不需要代理可单独关闭
seata: false
druid:
initial-size: 5
min-idle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
filters: stat,slf4j
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
# seata配置
seata:
# 关闭自动代理
enable-auto-data-source-proxy: false

View File

@@ -0,0 +1,5 @@
# dubbo 订阅配置
dubbo:
cloud:
# 需要远程调用的服务 多个用逗号分割
subscribed-services: ruoyi-system

25
config/dev/ruoyi-file.yml Normal file
View File

@@ -0,0 +1,25 @@
# dubbo 订阅配置
dubbo:
cloud:
# 需要远程调用的服务 多个用逗号分割
subscribed-services: ruoyi-system
# 本地文件上传
file:
domain: http://127.0.0.1:9300
path: D:/ruoyi/uploadPath
prefix: /statics
# FastDFS配置
fdfs:
domain: http://8.129.231.12
soTimeout: 3000
connectTimeout: 2000
trackerList: 8.129.231.12:22122
# Minio配置
minio:
url: http://8.129.231.12:9000
accessKey: minioadmin
secretKey: minioadmin
bucketName: test

View File

@@ -0,0 +1,93 @@
# dubbo 订阅配置
dubbo:
cloud:
# 需要远程调用的服务 多个用逗号分割
subscribed-services: ruoyi-auth,ruoyi-system
# 安全配置
security:
# 验证码
captcha:
# 是否开启验证码
enabled: true
# 验证码类型 math 数组计算 char 字符验证
type: MATH
# line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
category: CIRCLE
# 数字验证码位数
numberLength: 1
# 字符验证码长度
charLength: 4
# 防止XSS攻击
xss:
enabled: true
excludeUrls:
- /system/notice
# 不校验白名单
ignore:
whites:
- /auth/logout
- /auth/login
- /auth/register
- /*/v2/api-docs
- /csrf
spring:
cloud:
# 网关配置
gateway:
discovery:
locator:
lowerCaseServiceId: true
enabled: true
routes:
# 认证中心
- id: ruoyi-auth
uri: lb://ruoyi-auth
predicates:
- Path=/auth/**
filters:
# 验证码处理
- CacheRequestFilter
- ValidateCodeFilter
- StripPrefix=1
# 代码生成
- id: ruoyi-gen
uri: lb://ruoyi-gen
predicates:
- Path=/code/**
filters:
- StripPrefix=1
# 定时任务
- id: ruoyi-job
uri: lb://ruoyi-job
predicates:
- Path=/schedule/**
filters:
- StripPrefix=1
# 系统模块
- id: ruoyi-system
uri: lb://ruoyi-system
predicates:
- Path=/system/**
filters:
- StripPrefix=1
# 文件服务
- id: ruoyi-file
uri: lb://ruoyi-file
predicates:
- Path=/file/**
filters:
- StripPrefix=1
# sentinel 配置
sentinel:
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: ${spring.cloud.nacos.server-addr}
dataId: sentinel-${spring.application.name}
groupId: ${spring.cloud.nacos.config.group}
data-type: json
rule-type: flow

40
config/dev/ruoyi-gen.yml Normal file
View File

@@ -0,0 +1,40 @@
# dubbo 订阅配置
dubbo:
cloud:
# 需要远程调用的服务 多个用逗号分割
subscribed-services: ruoyi-system
# swagger配置
swagger:
title: 代码生成接口文档
spring:
datasource:
dynamic:
# 设置默认的数据源或者数据源组,默认值即为 master
primary: master
datasource:
# 主库数据源
master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${datasource.system-master.url}
username: ${datasource.system-master.username}
password: ${datasource.system-master.password}
# 从库数据源
slave:
lazy: true
driver-class-name:
url:
username:
password:
# 代码生成
gen:
# 作者
author: ruoyi
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.system
# 自动去除表前缀默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_

0
config/dev/ruoyi-job.yml Normal file
View File

View File

@@ -0,0 +1,7 @@
# 监控中心配置
monitor:
user:
name: ruoyi
password: 123456
ui:
title: RuoYi-Cloud-Plus服务监控中心

View File

@@ -0,0 +1,29 @@
# dubbo 订阅配置
dubbo:
cloud:
# 需要远程调用的服务 多个用逗号分割
subscribed-services: ruoyi-file
# swagger配置
swagger:
title: 系统模块接口文档
spring:
datasource:
dynamic:
# 设置默认的数据源或者数据源组,默认值即为 master
primary: master
datasource:
# 主库数据源
master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${datasource.system-master.url}
username: ${datasource.system-master.username}
password: ${datasource.system-master.password}
# 从库数据源
slave:
lazy: true
driver-class-name:
url:
username:
password:

View File

@@ -0,0 +1,34 @@
[
{
"resource": "ruoyi-auth",
"count": 500,
"grade": 1,
"limitApp": "default",
"strategy": 0,
"controlBehavior": 0
},
{
"resource": "ruoyi-system",
"count": 1000,
"grade": 1,
"limitApp": "default",
"strategy": 0,
"controlBehavior": 0
},
{
"resource": "ruoyi-gen",
"count": 200,
"grade": 1,
"limitApp": "default",
"strategy": 0,
"controlBehavior": 0
},
{
"resource": "ruoyi-job",
"count": 300,
"grade": 1,
"limitApp": "default",
"strategy": 0,
"controlBehavior": 0
}
]