xxl-job docker-compose配置一直出现 java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up

4szc88ey  于 4个月前  发布在  Docker
关注(0)|答案(1)|浏览(220)

我的docker-compose设置
mysql配置
db:
image: mysql:latest
hostname: db
container_name: db
environment:

  • MYSQL_ROOT_PASSWORD=root
    ports:
  • "3306:3306"
    networks:
  • dasheng-network
    xxl设置
    xxl-job-admin:
    image: xuxueli/xxl-job-admin:2.4.0
    container_name: xxl-job-admin
    hostname: xxl-job-admin
    privileged: true
    links:
  • db
    environment:
  • PARAMS=--spring.datasource.url=jdbc:mysql://db:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai --spring.datasource.password=root --spring.datasource.username=root
    ports:
  • 18080:8080
    depends_on:
  • db
    volumes:
  • /xxl-job/:/data/applogs
    networks:
  • dasheng-network

错误

xxl-job-admin | 20:41:05.910 logback [xxl-job, admin JobScheduleHelper#scheduleThread] ERROR com.zaxxer.hikari.pool.HikariPool - HikariCP - Exception during pool initialization.
xxl-job-admin | java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
xxl-job-admin | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
xxl-job-admin | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
xxl-job-admin | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
xxl-job-admin | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
xxl-job-admin | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
xxl-job-admin | at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:894)
xxl-job-admin | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:819)
xxl-job-admin | at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:444)
xxl-job-admin | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237)
xxl-job-admin | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
xxl-job-admin | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
xxl-job-admin | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
xxl-job-admin | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)

相关问题