Skip to main content

dawdler-discovery-center-consul-core

Module Introduction​

The core module of the Consul-based registry implementation. It provides a singleton class for Consul operations and the implementation class for health checking.

1. Configuration Files​

A local configuration file or a unified configuration center is supported.

1.1 Local Configuration File​

The consul.properties file is located on the project classpath.

host=127.0.0.1
port=8500
#token=2e6dccf2-3f9b-d8e9-e20d-0d5979bf0f23
#healthCheckType=tcp
#checkTime=6s
#keyStoreInstanceType=JKS
#certificatePath=/home/srchen/certificatePath/xxx
#certificatePassword=password
#keyStorePath=/home/srchen/keyStorePath/xxx
#keyStorePassword=password

1.2 Unified Configuration Center​

For the unified configuration center, see the Unified Configuration Center module

The path inside consul is /consul

host: 127.0.0.1
port: 8500
#token: 2e6dccf2-3f9b-d8e9-e20d-0d5979bf0f23
#healthCheckType: tcp
#checkTime: 6s
#keyStoreInstanceType: JKS
#certificatePath: /home/srchen/certificatePath/xxx
#certificatePassword: password
#keyStorePath: /home/srchen/keyStorePath/xxx
#keyStorePassword: password

1.3 Configuration Parameter Description​

host: the IP address of Consul.

port: the port number of Consul.

token: the token of Consul. If it is not configured, no token is needed.

healthCheckType: the health check method used by the server side; defaults to tcp. http is also supported, and using http requires configuring server-side health check.

checkTime: the health check interval (defaults to 6 seconds).

reVerifyInterval: the registration self-verification interval in seconds (default 30). Internally, a single shared daemon scheduler queries the local registry in the agent's domain and re-registers only when the registration is found to be lost (e.g. the agent restarted), replacing the old 5-second full catalog polling via isExist.

keyStoreInstanceType: the certificate type. Currently JKS, JCEKS, PKCS12, PKCS11 and DKS are supported.

certificatePath: the path where the certificate is located.

certificatePassword: the certificate password.

keyStorePath: the path where the private key is located.

keyStorePassword: the private key password.