Skip to main content
版本:当前版本

Admin属性配置

本篇主要讲解如何在 admin端配置 ShenYu 的相关属性。

属性配置

shenyu:
register:
registerType: http #http #zookeeper #etcd #nacos #consul
serverLists: #localhost:2181 #http://localhost:2379 #localhost:8848
props:
sessionTimeout: 5000
connectionTimeout: 2000
checked: true
zombieCheckTimes: 5
scheduledTime: 10
nacosNameSpace: ShenyuRegisterCenter
sync:
websocket:
enabled: true
messageMaxSize: 10240
allowOrigins: ws://localhost:9095;ws://localhost:9195;
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
# connectionTimeout: 2000
# http:
# enabled: true
# nacos:
# url: localhost:8848
# namespace: 1c10d748-af86-43b9-8265-75f487d20c6c
# username:
# password:
# acm:
# enabled: false
# endpoint: acm.aliyun.com
# namespace:
# accessKey:
# secretKey:
# etcd:
# url: http://localhost:2379
# consul:
# url: http://localhost:8500
aes:
secret:
key: 2095132720951327
iv: 6075877187097700
ldap:
enabled: false
url: ldap://xxxx:xxx
bind-dn: cn=xxx,dc=xxx,dc=xxx
password: xxxx
base-dn: ou=xxx,dc=xxx,dc=xxx
object-class: person
login-field: cn
jwt:
expired-seconds: 86400000
shiro:
white-list:
- /
- /favicon.*
- /static/**
- /index**
- /plugin
- /platform/**
- /websocket
- /configs/**
- /shenyu-client/**
- /error
- /actuator/health
- /swagger-ui.html
- /webjars/**
- /swagger-resources/**
- /v2/api-docs
- /csrf
swagger:
enable: true

属性详解

shenyu.register 配置

这是客户端接入的相关配置,客户端接入原理请参考:客户端接入原理 ,客户端接入配置请参考: 客户端接入配置

名称类型默认值是否必填说明
registerTypeStringhttp必填使用哪种方式进行服务注册,当前支持 httpzookeeperetcdconsulnacos
serverListsString非必填配置中心的地址。使用http方式时,不需要填写,其他类型需要填写。集群时,多个地址用 , 分开 。
props使用不同注册类型时,属性取值不同。
  • props配置

使用不同的注册类型时,属性取值不同。

当注册类型为http时,支持的属性配置如下:

名称类型默认值是否必填说明
checkedbooleanfalse是否开启检测
zombieCheckTimesint5失败几次后剔除服务
scheduledTimeint10定时检测间隔时间 (秒)

当注册类型为zookeeper时,支持的属性配置如下:

名称类型默认值是否必填说明
sessionTimeoutint30000session超时时间(毫秒)
connectionTimeoutint3000连接超时时间(毫秒)

当注册类型为etcd时,暂时没有属性配置。

当注册类型为nacos时,支持的属性配置如下:

名称类型默认值是否必填说明
nacosNameSpaceString命名空间
usernameString空字符串用户名
passwordString空字符串密码
accessKeyString空字符串accessKey
secretKeyString空字符串secretKey

当注册类型为consul时,支持的属性配置如下:

名称类型默认值是否必填说明
delayint1Metadata的监控每次轮询的间隔时长,单位为秒,默认1秒。
wait-timeint55Metadata的监控单次请求的等待时间(长轮询机制),单位为秒,默认55秒。
metadata-pathStringshenyu/registerMetadata路径名称,默认是shenyu/register
shenyu.sync 配置

Admin端和网关使用数据同步的相关配置。

使用websocket进行数据同步的属性配置如下:

名称类型默认值是否必填说明
enabledbooleantrue是否启用websocket进行数据同步
messageMaxSizeint0设置websocket缓冲区大小,单位为bytes
allowOriginsString空字符串设置允许的 origins, 多个参数以;分隔

使用zookeeper进行数据同步的属性配置如下:/

名称类型默认值是否必填说明
urlStringzookeeper的连接地址
sessionTimeoutintsession的超时时间(毫秒)
connectionTimeoutint连接超时时间(毫秒)

使用http长轮询进行数据同步的属性配置如下:

名称类型默认值是否必填说明
enabledbooleantrue是否启用
refreshIntervalint5 (分钟)定时从数据库获取数据并加载到内存
notifyBatchSizeint100批量通知客户端

使用nacos进行数据同步的属性配置如下:

名称类型默认值是否必填说明
urlStringnacos连接地址
namespaceString命名空间
usernameString用户名
passwordString密码
acm阿里云ACM服务配置
  • acm配置
名称类型默认值是否必填说明
enabledbooleanfalse是否启用
endpointStringACM服务地址
namespaceStringnamespace
accessKeyStringaccessKey
secretKeyStringsecretKey

使用etcd进行数据同步的属性配置如下:

名称类型默认值是否必填说明
urlStringetcd连接地址

使用consul进行数据同步的属性配置如下:

名称类型默认值是否必填说明
urlStringconsul连接地址
shenyu.aes.secret 配置

aes加密算法的相关配置。

名称类型默认值是否必填说明
keyString2095132720951327key
ivString初始向量
shenyu.ldap 配置

Springldap的相关配置。

名称类型默认值是否必填说明
enabledbooleantrue是否启用
urlStringldap连接地址
bind-dnStringUserDn
passwordString密码
base-dnStringsearchBase
object-classStringpersonfilter
login-fieldStringcnsearchBase
connectTimeoutint3000连接超时时间(毫秒)
readTimeoutint3000读取操作超时时间(毫秒)
shenyu.jwt 配置

jwt的相关配置如下:

名称类型默认值是否必填说明
expired-secondslong24 60 60 * 1000L过期时间(毫秒)
shenyu.shiro 配置

shiro的相关配置如下:

名称类型默认值是否必填说明
white-listList白名单列表