nacos source code build

Environmental preparation

  • JDK 1.8+
  • Maven 3.2+

process

  • Source code download
https://github.com/alibaba/nacos

Insert image description here

  • Import idea project
    Insert image description here
    Insert image description here

  • To run the source code
    , enter the nacos-console module and start the com.alibaba.nacos.Nacos class under this module.
    Insert image description here
    Normally, the following error will be reported:
    Insert image description here
    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

Insert image description here

  • 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
Insert image description here

  • Login nacos/nacos
    Insert image description here

Guess you like

Origin blog.csdn.net/u014535922/article/details/131005146