How to Solve “Error db.num is null” when starting Nacos

Nacos startup is divided into stand-alone or cluster. When you start in cluster mode but do not configure the data source that the cluster depends on, the error db.num is null will be reported

Solution

The operation of this paper is based on Windows environment, similar to Linux

Mode 1: single machine mode startup

startup.cmd -m standalone

Start as shown in the figure below:

standalone: independent
at this time, Nacos starts in stand-alone mode

Mode 2: start in cluster mode and configure the data source

Use the conf/nacos-mysql.sql file to initialize the database, and modify the conf/application.properties file to add MySQL support

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://localhost:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=root
db.password=1234

All the above configurations exist in the original configuration. You only need to modify the parameter value
after the modification is successful, start Nacos

startup.bat

Read More: