-
下载安装nacos-1.3.0
打开Nacos的官网:https://nacos.io,找到了Nacos的1.3.0版本:https://github.com/alibaba/nacos/releases/tag/1.3.0,下载好zip包后解压
-
配置nacos
-
创建nacos数据库
在mysql数据库下创建nacos库,并在这个库上运行
${nacos-home}/conf
下的nacos-mysql.sql
脚本 -
放入数据库连接jar包
nacos项目导入的是5.6版本的数据库连接jar包,而我们用的是8.0.21版本的mysql数据库,需要在nacos安装目录下新建
plugins/mysql
文件夹,并把下载的mysql-connector-java-8.0.21.jar
jar包放进去 -
编辑application.properties配置文件
spring.datasource.platform=mysql db.num=1 db.url.0=jdbc:mysql://${server}:${port}/nacos?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC db.user=${user} db.password=${password}
-
第一次启动
打开cmd,切换到
${nacos-home}/bin
目录下,运行startup.cmd
启动脚本,第一次启动会报错“Unable to start embedded Tomcat”,不用担心,按下面的流程走 -
放入内置tomcat包
打开
${nacos-home}/bin/work/Tomcat/localhost/nacos
文件夹,发现里面是空的,在${nacos-home}/target
下有nacos-server.jar
这样一个jar包,把这个jar包放到${nacos-home}/bin/work/Tomcat/localhost/nacos
下
-
-
启动并验证
打开cmd,切换到
${nacos-home}/bin
目录下,运行startup.cmd
启动脚本启动完成后,打开浏览器输入
http://localhost:8848/nacos
回车,输入账号密码完成