客户端属性配置
本篇主要讲解如何在客户端接入时配置 ShenYu 的相关属性。
在你的微服务中设置shenyu属性,比如,在shenyu-examples-http 中相关配置如下:
属性配置
shenyu:
client:
registerType: http #zookeeper #etcd #nacos #consul
serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379 #localhost:8848
props:
contextPath: /http
appName: http
port: 8189
nacosNameSpace: ShenyuRegisterCenter
属性详解
shenyu.client 配置
这是客户端接入的相关配置,客户端接入原理请参考:客户端接入原理 ,客户端接入配置请参考: 客户端接入配置 。
| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
|---|---|---|---|---|
| registerType | String | http | 必填 | 使用哪种方式进行服务注册,当前支持 http、zookeeper、etcd、consul和nacos 。 |
| serverLists | String | 无 | 必填 | 配置中心的地址。集群时,多个地址用 , 分开 。 |
| props | 使用不同注册类型时,属性取值不同。 |
props配置
微服务由不同协议构建时,属性配置略有不同,通用属性如下:
| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
|---|---|---|---|---|
| contextPath | String | 无 | 是 | 服务在网关中的路由前缀 |
| appName | String | 无 | 是 | 服务名称。springcloud服务无需配置,请通过spring.application.name配置。 |
| host | String |