1. Nacos Server
For the server side, it is usually set in {nacos.home}/conf/application.properties
. If the parameter name is marked with (-D), it means that it is a JVM parameter and needs to be set in Make corresponding settings in :{nacos.home}/bin/startup.sh
. For example, to set the value of nacos.home, you can set it as follows in{nacos.home}/bin/startup.sh
JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"
global parameters
parameter name | meaning | Optional value | default value | Supported version |
---|---|---|---|---|
nacos.home(-D) | Nacos root directory | directory path | Nacos installation directory | >= 0.1.0 |
nacos.standalone(-D) | Whether in stand-alone mode | true/false | false | >= 0.1.0 |
nacos.functionMode(-D) | Startup mode supports starting only a certain module. If not set, all modules will be started. | config/naming/empty | null | >= 0.9.0 |
nacos.inetutils.prefer-hostname-over-ip | cluster.conf Should it be filled in?hostname |
true/false | false | >= 0.3.0 |
nacos.inetutils.ip-address | Local IP. After this parameter is set, this IP will be used to match in cluster.conf . Please ensure that the value of this IP is in cluster.conf exists |
Local IP | null | >= 0.3.0 |
Naming module
parameter name | meaning | Optional value | default value | Supported version |
---|---|---|---|---|
nacos.naming.data.warmup | Whether to perform data warm-up when the server starts | true/false | false | >= 1.0.2 |
nacos.naming.expireInstance | Whether to automatically remove temporary instances | true/false | true | >= 1.0.2 |
nacos.naming.distro.taskDispatchPeriod | The period of synchronization task generation, in milliseconds | positive integer | 2000 | >= 1.0.2 |
nacos.naming.distro.batchSyncKeyCount | The number of keys in each batch of synchronization tasks | positive integer | 1000 | >= 1.0.2 |
nacos.naming.distro.syncRetryDelay | Retry interval for synchronization task failure, in milliseconds | positive integer | 5000 | >= 1.0.2 |
In addition to the attributes configured in application.properties
listed above, there are also some parameters that can be adjusted by calling the interface at runtime. These parameters are all in Open APIThere are declarations in this API查看系统当前数据指标
.
Config module
parameter name | meaning | Optional value | default value | Supported version |
---|---|---|---|---|
db.num | Number of databases | positive integer | 0 | >= 0.1.0 |
db.url.0 | The URL of the first database | string | null | >= 0.1.0 |
db.url.1 | The URL of the second database | string | null | >= 0.1.0 |
db.user | Username for database connection | string | null | >= 0.1.0 |
db.password | Database connection password | string | null | >= 0.1.0 |
spring.datasource.platform | Database type | string | mysql | >=1.3.0 |
db.pool.config.xxx | Database connection pool parameters, hikari connection pool is used, the parameters are the same as hikari connection pool, such asdb.pool.config.connectionTimeout or db.pool.config.maximumPoolSize |
string | Same as hikariCp corresponding default configuration | >=1.4.1 |
The current database configuration supports multiple data sources. Use db.num
to specify the number of data sources, and db.url.index
to be the link to the corresponding database. When db.user
and db.password
are not set index
, all links end with db.user
and will be cut as the final value for authentication, which will cause authentication failure. , the previous value after . Therefore, when the username or password exists do not specify a subscript, the current mechanism will cut according to and To set the user or password corresponding to the database link. It should be noted that when , to cut, or specify db.password
is used for authentication. If the user names or user passwords of different data sources are different, you can use the symbols ,
db.user.index
db.user.password
db.user
db.password
,
,
,
Nacos has used HikariCP connection pool since version 1.3, but before version 1.4.1, the connection pool configuration was defined by the system default value and the configuration could not be customized. After 1.4.1, a method is provided to configure the HikariCP connection pool. db.pool.config
is the configuration prefix, xxx
is the actual hikariCP configuration, such as db.pool.config.connectionTimeout
or db.pool.config.maximumPoolSize
, etc. For more configurations of hikariCP, please see HikariCP It should be noted that the url, user, and password will be changed by db.url.n
, coverage, driverClassName is the default MySQL8 driver (this version of mysql driver supports mysql5.x)db.user
,db.password
CMDB module
parameter name | meaning | Optional value | default value | Supported version |
---|---|---|---|---|
nacos.cmdb.loadDataAtStart | Whether to open CMDB | true/false | false | >= 0.7.0 |
nacos.cmdb.dumpTaskInterval | The interval between full dumps, in seconds | positive integer | 3600 | >= 0.7.0 |
nacos.cmdb.eventTaskInterval | Pull interval for change events, in seconds | positive integer | 10 | >= 0.7.0 |
nacos.cmdb.labelTaskInterval | The pull interval for the label collection, in seconds | positive integer | 300 | >= 0.7.0 |
二、Nacos Java Client
The parameters of the client are divided into two types, one is the configuration specified through the -D parameter, and the other is the configuration specified through the Properties
object when constructing the client. There are no following Those marked with -D are configurations injected through Properties
.
Common parameters
parameter name | meaning | Optional value | default value | Supported version |
---|---|---|---|---|
endpoint | Connect to the connection point specified by Nacos Server, please refer toDocumentation | domain name | null | >= 0.1.0 |
endpointPort | Connect to the connection point port specified by Nacos Server, please refer toDocumentation | Legal port number | null | >= 0.1.0 |
namespace | Namespace ID | Namespace ID | The config module is empty and the naming module is public. | >= 0.8.0 |
serverAddr | The address list of Nacos Server. This value has a higher priority than the endpoint. | ip:port,ip:port,... | null | >= 0.1.0 |
JM.LOG.PATH(-D) | Directory of client logs | directory path | User root directory | >= 0.1.0 |
Naming client
parameter name | meaning | Optional value | default value | Supported version |
---|---|---|---|---|
namingLoadCacheAtStart | Whether to give priority to reading the local cache when starting | true/false | false | >= 1.0.0 |
namingCacheRegistryDir | Specify the cache subdirectory, the location is .../nacos/{SUB_DIR}/naming |
Subdirectory path | empty string | >=2.0.2 |
namingClientBeatThreadCount | Thread pool size for client heartbeat | positive integer | Half the number of CPUs of the machine | >= 1.0.0 |
namingPollingThreadCount | The size of the thread pool for the client to periodically poll for data updates | positive integer | Half the number of CPUs of the machine | >= 1.0.0 |
com.alibaba.nacos.naming.cache.dir(-D) | Client cache directory | directory path | {user.home}/nacos/naming |
>= 1.0.0 |
com.alibaba.nacos.naming.log.level(-D) | Naming client log level | info,error,warn等 | info | >= 1.0.0 |
com.alibaba.nacos.client.naming.tls.enable(-D) | Whether to turn on HTTPS | true/false | false | >= 1.0.0 |
Config client
parameter name | meaning | Optional value | default value | Supported version |
---|---|---|---|---|
configLongPollTimeout (config.long-poll.timeout version 1.0.1) | Long polling timeout in milliseconds | positive integer | 30000 | >= 1.0.2 |
configRetryTime (config.retry.time version 1.0.1) | Long polling task retry time, in milliseconds | positive integer | 2000 | >= 1.0.2 |
maxRetry | Number of retries for long polling | positive integer | 3 | >= 1.0.2 |
enableRemoteSyncConfig | Pull the remote configuration when the listener is first added | Boolean value | false | >= 1.0.2 |
com.alibaba.nacos.config.log.level(-D) | Config client log level | info,error,warn等 | info | >= 1.0.0 |
JM.SNAPSHOT.PATH(-D) | Client cache directory | directory path | {user.home}/nacos/config | >= 1.0.0 |
Original text from: nacos official website