关于nacos1.2开启权限后服务连接403,以及nacos修改默认账号密码问题
背景
nacos作为配置中心,注册中心权限控制真的很重要。
版本:springcloud Hoxton.RELEASE、alibaba-cloud 2.2.0.RELEASE、nacos 0.9.0
开启NACOS_AUTH_ENABLE=true后服务注册失败
官网错误:https://github.com/alibaba/nacos/issues/2442 官网一大堆这个bug(吐槽一下,本来1.2的特点就是能开启校验结果还有bug。还是正式版本。。)
参考
依旧使用1.2nacos:参考这位大哥的:https://blog.csdn.net/qq_35337554/article/details/104914397
替换升级1.3.2版本(往后看)
按照官网建议:
替换版本
以前:
由于之前使用的springCloud是2.2.0版本的且nacos是0.9.0现在替换为alibaba2.2.1,根据nacos官方文档,需要升级spring cloud版本,我用的是Hoxton.RELEASE–>>Hoxton.SR7
如下:
<nacos.version>2.2.1.RELEASE</nacos.version>
<nacos-client.version>1.3.2</nacos-client.version>
在机器上下载nacos1.3.2(自行百度步骤)
需要注意的配置:
spring.datasource.platform=mysql
nacos.core.auth.enabled=true
安装过程需要更改初始账号密码(谁可能就用默认的nacos/nacos,目前大部分文章就是用默认的)
注意:
1.那就是用户名和密码存在特殊字符的时候会出现403,unknown user 问题:当出现特殊字符的时候,request.getParameter存在转义问题。避免特殊字符。
2.这是我亲自试的,且在官网提了issues,懒得追究结果(目前时间不允许,后续研究),目前支持使用:
后续:
由于springcloud,alibaba.cloud版本替换,导致的各种问题包括:rocketMq报错:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.alibaba.cloud.stream.binder.rocketmq.RocketMQMessageChannelBinder.createProducerMessageHandler(RocketMQMessageChannelBinder.java:172)
The following method did not exist:
org.springframework.integration.channel.AbstractMessageChannel.getChannelInterceptors()Ljava/util/List;
The method's class, org.springframework.integration.channel.AbstractMessageChannel, is available from the following locations:
jar:file:/xzb/5_course/xzb-course.jar!/BOOT-INF/lib/spring-integration-core-5.3.2.RELEASE.jar!/org/springframework/integration/channel/AbstractMessageChannel.class
The class hierarchy was loaded from the following locations:
org.springframework.integration.channel.AbstractMessageChannel: jar:file:/xzb/5_course/xzb-course.jar!/BOOT-INF/lib/spring-integration-core-5.3.2.RELEASE.jar!/
org.springframework.integration.context.IntegrationObjectSupport: jar:file:/xzb/5_course/xzb-course.jar!/BOOT-INF/lib/spring-integration-core-5.3.2.RELEASE.jar!/
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.integration.channel.AbstractMessageChannel
参考:关于RocketMQMessageChannelBinder.java:172报错method that does not exist:
连接:https://blog.csdn.net/weixin_41546244/article/details/110633253
转载注明出处,谢谢。