Skip to main content
Version: 2.6.1

Client Property Config

This paper mainly explains how to configure the properties of Apache ShenYu when the client accesses the gateway.

Set the shenyu property in your microservice, for example, in shenyu-examples-http :

Property Config#

shenyu:  client:    registerType: http #zookeeper #etcd #nacos #consul #apollo    serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379 #localhost:8848 #localhost:8080    props:      contextPath: /http      appName: http      port: 8189      nacosNameSpace: ShenyuRegisterCenter

Property Detail#

shenyu.client config#

This section describes configurations related to client access. For details about client access principles, see: Application Client Access , for client access configuration, see: Application Client Access Config .

NameTypeDefaultRequiredDescription
registerTypeStringhttpYesWhich mode to use for registry. Currently, http, zookeeper, etcd, consul ,apollo and nacos are supported.
serverListsStringnullNoConfigure the address of the registry. In clustering, multiple addresses are separated by commas (,).
propsThe value of the property varies according to the registerType.
  • props config

When microservices are built by different protocols, the property configuration is slightly different. The general attributes are as follows:

NameTypeDefaultRequiredDescription
contextPathStringnullYesThe route prefix of the microservice in the gateway.
appNameStringnullYesmicroservice name. springcloud service don't set, please set spring.application.name.
hostStringnullYesmicroservice address
portintnullYesmicroservice port
isFullbooleanfalseNoWhether to proxy the all service, currently just applies to springmvc/ springcloud
ipAndPortStringnullNoService IP and port address, currently just applies to gRPC Proxy.
shutdownWaitTimeint3000Noshutdown wait time(millisecond)
delayOtherHooksExecTimeint2000Nohook execute time(millisecond)
applicationShutdownHooksClassNameStringjava.lang.ApplicationShutdownHooksNohook execute class name
applicationShutdownHooksFieldNameStringhooksNohook execute field name

The value of the property varies according to the registerType.

When the registerType is nacos, there has no other properties.

When the registerType is zookeeper, the supported properties are as follows.

NameTypeDefaultRequiredDescription
sessionTimeoutint30000Nosession time out(millisecond)
connectionTimeoutint3000Noconnection time out(millisecond)

When the registerType is etcd, the supported properties are as follows.

NameTypeDefaultRequiredDescription
etcdTimeoutint30000Noetcd time out(millisecond)
etcdTTLint5Noclient lease time to live(second)

When the registerType is nacos, the supported properties are as follows.

NameTypeDefaultRequiredDescription
nacosNameSpaceStringnullYesnamespace
usernameString""Nousername
passwordString""Nopassword
accessKeyString""NoaccessKey
secretKeyString""NosecretKey

When the registerType is apollo, the supported properties are as follows.

NameTypeDefaultRequiredDescription
appIdString"shenyu"YesappId
envString""Yesenv
clusterNameString""YesclusterName
namespaceString""Yesnamespace
tokenString""Yestoken
portalUrlString""YesportalUrl

When the registerType is consul, no other property configuration is provided. please set spring.cloud.consul for the configuration.