Table of contents
Environmental preparation
- JDK 1.8+
- Maven 3.2+
process
- Source code download
https://github.com/alibaba/nacos
-
Import idea project
-
To run the source code
, enter the nacos-console module and start the com.alibaba.nacos.Nacos class under this module.
Normally, the following error will be reported:
This is because nacos uses the cluster mode by default. When starting, it will go to the default configuration path and look for the cluster configuration file
cluster.conf.
When our source code is run, we usually use stand-alone mode, so we need to set it in the startup parameters. In the startup parameters of jvm
, add
-Dnacos.standalone=true
- Configure the database
and modify the configuration file application.properties file in the console module
#关闭认证缓存
nacos.core.auth.caching.enabled=false
#*************** Config Module Related Configurations ***************#
### If user MySQL as datasource:
spring.datasource.platform=mysql
### Count of DB:
db.num=1
### Connect URL of DB:
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8
db.user=root
db.password=root
Create a nacos database and execute the SQL script in the distribution module
- Login nacos/nacos