|
|
|
@ -6,6 +6,8 @@ import lombok.Getter;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
|
public class MilvusPlugin {
|
|
|
|
|
private static MilvusPlugin instance;
|
|
|
|
@ -26,10 +28,14 @@ public class MilvusPlugin {
|
|
|
|
|
ConnectParam connectParam = ConnectParam.newBuilder()
|
|
|
|
|
.withHost(host)
|
|
|
|
|
.withPort(port)
|
|
|
|
|
.withConnectTimeout(10, TimeUnit.SECONDS)
|
|
|
|
|
.withKeepAliveTime(55, TimeUnit.SECONDS)
|
|
|
|
|
.withKeepAliveTimeout(20, TimeUnit.SECONDS)
|
|
|
|
|
.withIdleTimeout(180, TimeUnit.SECONDS)
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
client = new MilvusServiceClient(connectParam);
|
|
|
|
|
logger.info("Milvus连接成功");
|
|
|
|
|
logger.info("Milvus连接成功,最大连接数:{}", maxConnections);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("Milvus初始化失败: " + e.getMessage(), e);
|
|
|
|
|
throw new RuntimeException("Milvus初始化失败", e);
|
|
|
|
|