docker-compose 部署时,nacos无法启动/nacos无法访问,但prometheus与grafana启动正常
报错信息如下
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)
at com.mysql.cj.NativeSession.connect(NativeSession.java:152)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:849)
... 25 common frames omitted
Caused by: java.net.UnknownHostException: ${MYSQL_SERVICE_HOST}
at java.net.InetAddress.getAllByName0(InetAddress.java:1281)
at java.net.InetAddress.getAllByName(InetAddress.java:1193)
at java.net.InetAddress.getAllByName(InetAddress.java:1127)
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:132)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
... 27 common frames omitted
您好,根据提示,无法识别该变量:MYSQL_SERVICE_HOST Caused by: java.net.UnknownHostException: ${MYSQL_SERVICE_HOST}。 在yml中定义查看环境变量定义是否正确: 参考:
environment:
MYSQL_SERVICE_HOST: 1.1.1.1
MYSQL_PASSWORD: "mysql"
这里的环境变量为启动容器时,传入容器的环境变量。 当然,你可以可以再操作系统定义环境变量/etc/profile.
看报错是 java.net.UnknownHostException: ${MYSQL_SERVICE_HOST}
没有设置这个参数啊${MYSQL_SERVICE_HOST} MYSQL_MASTER_SERVICE_HOST这个不识别
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。