环境 Vm Os debian11 虚拟机中容器,创建一个共享网络common-network bridge模式,mysql、nacos共享这个网络。mysq与nacos是用名字查找。 默认情况nacos启动成功。 nacos 2.0.3 mysql 8.0.26(比较新)
出错现象 当docker全部重启后,nacos无法连接mysql。
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'memoryMonitor' defined in URL [jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-config-2.0.3.jar!/com/alibaba/nacos/config/server/monitor/MemoryMonitor.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncNotifyService': Unsatisfied dependency expressed through field 'dumpService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalDumpService': Invocation of init method failed; nested exception is ErrCode:500, ErrMsg:Nacos Server did not start because dumpservice bean construction failur
java.lang.IllegalStateException: No DataSource set
在nacos容器中始终可以ping mysql ping通的。
问题在于有时时候重新启动nacos容器居然连接成功了?大多数时候都失败。
问题复现 只要mysql容器重新启动,就出现这个现象
目前解决 Mysql容器重启后,在宿主机mysql工具navicat连接一次nacos_config(navicat目录打开一次),nacos容器就能正常启动了。