Nacos V2.0 开发搭建
下载
-
nacos-server-2.0.0.zip
下载后解压到D:\nacos目录中
修改配置
修改conf/application.properties
#*************** Config Module Related Configurations ***************#
### If use 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_v2?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=yourpass
修改bin/startup.cmd
将26行的set MODE=“cluster” 改为set MODE=“standalone”
rem set MODE="cluster"
set MODE="standalone"
不然会启动报错
2021-03-20 09:08:42,132 ERROR Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'distroFilterRegistration' defined in class path resource [com/alibaba/nacos/naming/web/NamingConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.FilterRegistrationBean]: Factory method 'distroFilterRegistration' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'distroFilter': Unsatisfied dependency expressed through field 'distroMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'distroMapper' defined in URL [jar:file:/E:/nacos/nacos-server-2.0.0/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.0.0.jar!/com/alibaba/nacos/naming/core/DistroMapper.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverMemberManager' defined in URL [jar:file:/E:/nacos/nacos-server-2.0.0/target/nacos-server.jar!/BOOT-INF/lib/nacos-core-2.0.0.jar!/com/alibaba/nacos/core/cluster/ServerMemberManager.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.nacos.core.cluster.ServerMemberManager]: Constructor threw exception; nested exception is ErrCode:500, ErrMsg:jmenv.tbsite.net
初始化数据库
执行脚本conf/nacos-mysql.sql (要求mysql5.6或mysql5.7)
启动
运行bin/startup.cmd
启动窗口出现以下类似信息表示启动成功。
2021-03-20 11:29:03,290 INFO Nacos started successfully in stand alone mode. use external storage