Home

Milvus

qianmoQqianmoQ· 更新于 2026-10-13· 阅读 4 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Milvus

Testcontainers module for Milvus.

Milvus's usage examples

You can start a Milvus container instance from any Java application by using:

Default config

MilvusContainer milvus = new MilvusContainer("milvusdb/milvus:v2.3.9")

With external Etcd:

External Etcd

Network network = Network.newNetwork();
GenericContainer<?> etcd = new GenericContainer<>("quay.io/coreos/etcd:v3.5.5")
    .withNetwork(network)
    .withNetworkAliases("etcd")
    .withCommand(
        "etcd",
        "-advertise-client-urls=http://127.0.0.1:2379",
        "-listen-client-urls=http://0.0.0.0:2379",
        "--data-dir=/etcd"
    )
    .withEnv("ETCD_AUTO_COMPACTION_MODE", "revision")
    .withEnv("ETCD_AUTO_COMPACTION_RETENTION", "1000")
    .withEnv("ETCD_QUOTA_BACKEND_BYTES", "4294967296")
    .withEnv("ETCD_SNAPSHOT_COUNT", "50000")
    .waitingFor(Wait.forLogMessage(".*ready to serve client requests.*", 1));
MilvusContainer milvus = new MilvusContainer("milvusdb/milvus:v2.3.9")
    .withNetwork(network)
    .withEtcdEndpoint("etcd:2379")
    .dependsOn(etcd)

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

GradleMaven

testImplementation "org.testcontainers:testcontainers-milvus:2.0.5"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>testcontainers-milvus</artifactId>
    <version>2.0.5</version>
    <scope>test</scope>
</dependency>

评论

登录后参与评论

正在加载评论…