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不是。
劑量任何人都知道如何解決運輸主機問題?