服务注册到Nacos集群注册失败,服务报400的原因

nacos 集群成功启动,但是将服务注册到nacos上报 400 重定向错误。

Caused by: com.alibaba.nacos.api.exception.NacosException:
 failed to req API:/nacos/v1/ns/instance after all servers([www.zw-dream.com]) tried: ErrCode:400, 
 ErrMsg:<html><body><h1>Whitelabel Error Page</h1>
 <p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Mon Dec 14 15:46:06 CST 2020</div><div>There was an unexpected error (type=Bad Request, status=400).</div><div>receive invalid redirect request from peer 192.160.0.102</div></body></html>

回到nacos启动上发现 nacos启动使用的是虚拟机上的网络地址,与配置文件使用的地址不一样
在这里插入图片描述
解决上述问题:前往 application.properties配置文件修改下面这项
在这里插入图片描述
重启nacos服务
到这里基本可以解决问题。
倘若又报 The Raft Group [naming_persistent_service_v2] did not find the Leader node Nacos服务下线问题。
则需要删除 data/protocol 文件
在这里插入图片描述
再一次:重启nacos服务
到这里问题完美解决。