diff --git a/build-docker/install/docker-compose.yml b/build-docker/install/docker-compose.yml index e0d4e4ac..c85a6cf1 100644 --- a/build-docker/install/docker-compose.yml +++ b/build-docker/install/docker-compose.yml @@ -11,6 +11,12 @@ services: MYSQL_PASSWORD: 123456 MYSQL_ROOT_PASSWORD: 123456 MYSQL_ROOT_HOST: '%' + healthcheck: + test: ["CMD", "mysql", "-uroot", "-p123456" ,"-e"," select 1 "] + interval: 10s + timeout: 3s + retries: 60 + start_period: 30s dbswitch: container_name: dbswitch_webui image: inrgihc/dbswitch:1.7.0 diff --git a/dbswitch-common/src/main/java/com/gitee/dbswitch/common/util/JDBCURL.java b/dbswitch-common/src/main/java/com/gitee/dbswitch/common/util/JDBCURL.java index d9554997..e6e20a14 100644 --- a/dbswitch-common/src/main/java/com/gitee/dbswitch/common/util/JDBCURL.java +++ b/dbswitch-common/src/main/java/com/gitee/dbswitch/common/util/JDBCURL.java @@ -75,11 +75,6 @@ public final class JDBCURL { */ public static boolean reachable(String host, String port) { try { - InetAddress address = InetAddress.getByName(host); - if (!address.isReachable(1500)) { - return false; - } - try (Socket socket = new Socket()) { socket.connect(new InetSocketAddress(host, Integer.parseInt(port)), 1500); } diff --git a/dbswitch-data/src/main/java/com/gitee/dbswitch/data/handler/MigrationHandler.java b/dbswitch-data/src/main/java/com/gitee/dbswitch/data/handler/MigrationHandler.java index 5ab8102b..1c8fa6c3 100644 --- a/dbswitch-data/src/main/java/com/gitee/dbswitch/data/handler/MigrationHandler.java +++ b/dbswitch-data/src/main/java/com/gitee/dbswitch/data/handler/MigrationHandler.java @@ -56,7 +56,7 @@ import org.springframework.util.StringUtils; @Slf4j public class MigrationHandler implements Supplier { - private final long MAX_CACHE_BYTES_SIZE = 128 * 1024 * 1024; + private final long MAX_CACHE_BYTES_SIZE = 512 * 1024 * 1024; private int fetchSize = 100; private final DbswichProperties properties; diff --git a/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java b/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java index e2e7e9a2..3776883c 100644 --- a/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java +++ b/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java @@ -111,8 +111,13 @@ public final class DataSourceUtils { } else { ds.setConnectionTestQuery("SELECT 1"); } - ds.setMaximumPoolSize(MAX_THREAD_COUNT); - ds.setMinimumIdle(MAX_THREAD_COUNT); + if (properties.getDriverClassName().contains("sqlite")) { + ds.setMaximumPoolSize(1); + ds.setMinimumIdle(1); + } else { + ds.setMaximumPoolSize(MAX_THREAD_COUNT); + ds.setMinimumIdle(MAX_THREAD_COUNT); + } ds.setMaxLifetime(properties.getMaxLifeTime()); ds.setConnectionTimeout(properties.getConnectionTimeout()); ds.setIdleTimeout(MAX_TIMEOUT_MS);