Skip to main content
Version: User Docs

Nacos system parameters introduce

Document optimizing...

Nacos Server

For Server side, usually set in {nacos.home}/conf/application.properties, if the parameter name after mark (-D), says is the JVM parameter, need in {nacos.home}/bin/startup.sh accordingly set up. Such as setting nacos. The value of the home, can be in {nacos.home}/bin/startup.sh the following Settings:

JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"

Global parameters

Parameter namesMeaningOptional valueDefault valueSupport version
nacos.home(-D)Nacos root directoryDirectory pathNacos installation directory>= 0.1.0
nacos.standalone(-D)Whether in stand-alone modetrue/falsefalse>= 0.1.0
nacos.functionMode(-D)Boot mode, support only start one module, do not set all modules will startconfig/naming/nullnull>= 0.9.0
nacos.inetutils.prefer-hostname-over-ipif you should fill in hostname in cluster.conftrue/falsefalse>= 0.3.0
nacos.inetutils.ip-addressNative IP, set this parameter, will use this IP tocluster.confmatching, please make sure that the IP value exists in the cluster.confNative IPnull>= 0.3.0

Naming module

Parameter namesMeaningOptional valueDefault valueSupport version
nacos.naming.data.warmupWhether the Server startup to preheat the datatrue/falsefalse>= 1.0.2
nacos.naming.expireInstanceWhether automatic removal of temporary instancetrue/falsetrue>= 1.0.2
nacos.naming.distro.taskDispatchPeriodSynchronization task generation cycle, millisecondspositive integer2000>= 1.0.2
nacos.naming.distro.batchSyncKeyCountThe number of each batch of key synchronization taskpositive integer1000>= 1.0.2
nacos.naming.distro.syncRetryDelaySynchronization task failure retry intervals, millisecondspositive integer5000>= 1.0.2

In addition to the above listed to in application.propertiesconfiguration properties, And some can be adjusted call interface at runtime, These parameters are in the Open APIexamine system current data indexthe API in a statement.

Config module

Parameter namesMeaningOptional valueDefault valueSupport version
db.numNumber of databasepositive integer0>= 0.1.0
db.url.0The first database URLstringnull>= 0.1.0
db.url.1The second database URLstringnull>= 0.1.0
db.userUser name of the database connectionstringnull>= 0.1.0
db.passwordDatabase connection passwordstringnull>= 0.1.0
spring.datasource.platformDatabase typestringmysql|>=1.3.0
db.pool.config.xxxDatabase connection pool parameters, using hikari connection pool, the parameters are the same as hikari connection pool, such as db.pool.config.connectionTimeout or db.pool.config.maximumPoolSizestringsame as hikariCp>=1.4.1

Now the db config support multi data source. It can set data source num by db.num, and db.url.index as the corresponding connection's url. When db.user and db.password are set without index, all db connection use db.user and db.password to auth. If the username or password is different with different data source, can split by symbol ,, or use db.user.index,db.user.password to set corresponding db connection's username or password. It is important to note that, when db.user or db.password are set without index, and the mechanism which split db.user,db.password by , exist, so if username or password contains ,, it will split the value by ,, and use split[0] to auth, failed to auth finally.

Nacos started to use HikariCP connection pool from version 1.3, but before version 1.4.1, the connection pool configuration is system default value, and the configuration could not be customized. After 1.4.1, Nacos provide a method 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 and so on. For more configuration of hikariCP, please check HikariCP It should be noted that url, user, password will be rewrite by db.url.n, db.user, db.password, and driverClassName is the default MySQL8 driver which supports mysql5.x.

CMDB module

Parameter namesMeaningOptional valueDefault valueSupport version
nacos.cmdb.loadDataAtStartWhether to open the CMDBtrue/falsefalse>= 0.7.0
nacos.cmdb.dumpTaskIntervalThe full amount of the interval of the dump, the unit is in secondspositive integer3600>= 0.7.0
nacos.cmdb.eventTaskIntervalThe pull interval change events, the unit is in secondspositive integer10>= 0.7.0
nacos.cmdb.labelTaskIntervalLabel the pull interval set, the unit is in secondspositive integer300>= 0.7.0

Nacos Java Client

TODO: Move to dependent document in user guide

Client parameters are divided into two kinds, one kind is through the -D parameter to specify the configuration of the client is a kind of structure, through Properties objects specified in the configuration, the following without -D marked by Properties injection configuration.

General parameters

Parameter namesMeaningOptional valueDefault valueSupport version
endpointConnection Nacos Server specify the connection point, you can refer to filedomain namenull>= 0.1.0
endpointPortConnection Nacos Server specify the connection port, you can refer to fileLegal portnull>= 0.1.0
namespacenamespace IDnamespace IDconfig module is empty, naming module is public>= 0.8.0
serverAddrNacos Server address list, this value is higher priority than the endpointip:port,ip:port,...null>= 0.1.0
JM.LOG.PATH(-D)client log directorydirectory pathroot directory of the user>= 0.1.0
com.alibaba.nacos.config.log.level(-D)Naming client log levelinfo,error,warn etcinfo>= 1.0.0
com.alibaba.nacos.naming.log.level(-D)Config client log levelinfo,error,warn etcinfo>= 1.0.0
com.alibaba.nacos.client.naming.tls.enable(-D)Whether to open the HTTPStrue/falsefalse>= 1.0.0

Naming client

Parameter namesMeaningOptional valueDefault valueSupport version
namingLoadCacheAtStartIf boot priority reads a local cachetrue/falsefalse>= 1.0.0
namingCacheRegistryDirThe subdirectory of cache, default is .../nacos/{SUB_DIR}/namingpath of SUB_DIRempty string>=2.0.2
namingClientBeatThreadCountclient's heartbeat thread pool sizepositive integernumber of the machine's CPU half>= 1.0.0
namingPollingThreadCountclient regularly polling data update the thread pool sizepositive integernumber of the machine's CPU half>= 1.0.0
com.alibaba.nacos.naming.cache.dir(-D)The directory of client cachepath of directory{user.home}/nacos/naming>= 1.0.0

Config client

Parameter namesMeaningOptional valueDefault valueSupport version
configLongPollTimeout(config.long-poll.timeout 1.0.1 version)Long polling timeout, millisecondspositive integer30000>= 1.0.2
configRetryTime(config.retry.time 1.0.1 version)Retry time long polling tasks, millisecondspositive integer2000>= 1.0.2
maxRetryLong polling retriespositive integer3>= 1.0.2
enableRemoteSyncConfigListeners are added to the remote configuration for the first timeboolean valuefalse>= 1.0.2