执行 java -jar target/kubeblog.jar 报错:
```
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.
```
先确认 mysql 容器正常在 master启动了:
```
[root@master Final]# docker ps -a |grep mysql
b765f935f024 registry.cn-beijing.aliyuncs.com/qingfeng666/mysql:5.7 "docker-entrypoint.s…" 5 months ago Up 2 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql57
```
然后在 master 服务器上尝试用 mysql 客户端登录:
```
mysql -uroot -h127.0.0.1 -p
```
如果能正常登录,确认数据库 blogDB 已经正常创建。如果都正常则排除了数据库的问题。
然后再看程序的mysql datasource 连接信息是否正确:
```
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/blogDB?useUnicode=true&characterEncoding=utf-8
```
在 mysql 正确启动之后,再运行 jar 包即可正常启动。