【nacos2.2.1本地启动】

@nacos2.2.1本地启动填坑之行

下载nacos代码

nacos文档地址:https://nacos.io/zh-cn/docs/quick-start-spring.html

github地址下载代码:https://github.com/alibaba/nacos.git

appllo文章:https://blog.51cto.com/muxiaonong/3933418

下载完成后idea呈现:
【nacos2.2.1本地启动】_第1张图片

启动naocs

1、找到nacos中console服务

2、配置启动参数,指定为单机:-Dnacos.standalone=true

【nacos2.2.1本地启动】_第2张图片

3、执行sql

【nacos2.2.1本地启动】_第3张图片

4、application.properties中修改sql配置

【nacos2.2.1本地启动】_第4张图片

4、application.properties中修改secret.key配置

# 随便填写key
nacos.core.auth.plugin.nacos.token.secret.key=123jiosjoijodjaosidj123123123123123123123123

【nacos2.2.1本地启动】_第5张图片

5、不填写key后果

原因:nacos 2.2.1版本及以后开启了默认鉴权,需要填写jwt key,

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:423)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at com.alibaba.nacos.Nacos.main(Nacos.java:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:64)

6、启动nacos

【nacos2.2.1本地启动】_第6张图片

6、访问nacos,

地址:http://localhost:8848/nacos/#/login
默认账号密码:nacos nacos

【nacos2.2.1本地启动】_第7张图片
【nacos2.2.1本地启动】_第8张图片

你可能感兴趣的:(nacos,java,spring,boot)