1
我尝试使用elasticsearch容器编写测试。 我用https://www.testcontainers.org/库运行它。 这是我的配置:用于测试的Elasticsearch和Testcontainers
@ClassRule
public static GenericContainer elasticContainer =
new GenericContainer("docker.elastic.co/elasticsearch/elasticsearch:5.3.0")
.withExposedPorts(9300, 9200)
.withEnv("xpack.security.enabled", "false")
.withEnv("transport.host", "127.0.0.1")
.withEnv("http.host", "0.0.0.0");
而且我得到了一个例外:
org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{9fuJUZYWS6O6IgLGOgJDaA}{localhost}{127.0.0.1:32792}]
我重新配置我的端口,用于测试和9200端口是可用的(即由testcontainers映射端口) - 我被检查了它卷曲。但9300不是。
剂量任何人都知道如何解决运输主机问题?