0
我我的本地机器上运行elasticsearch通过码头工人和可以正常访问它在REST API端口连接到elasticsearch在端口9300 9200不能在泊坞窗
阿帕奇弗林克与elasticsearch了用于通信端口9300
我的目标是把数据从阿帕奇弗林克到elasticsearch在一个水槽,但在我的程序每次执行我得到的Java错误:
Elasticsearch client is not connected to any Elasticsearch nodes!
我泊坞窗命令运行,容器会像这样:
docker run --rm -d -p 9200:9200 -p 9300:9300 -p 5601:5601 --name es-kibana nshou/elasticsearch-kibana
我还尝试通过“-p 0.0.0.0:9300:9300”打开端口9300或使用官方docker容器进行elasticsearch。
是否有人也遇到这个问题,并有任何解决方案?接下来我想尝试的是在我的机器上本地安装elasticsearch,但我认为码头方式更有价值。
这里也是我的弗林克代码和elasticsearch创建索引和映射:
List<InetSocketAddress> transports = new ArrayList<>();
transports.add(new InetSocketAddress(InetAddress.getByName("0.0.0.0"), 9300));
tweets.addSink(new ElasticsearchSink<Tuple2<String, Integer>>(
config,
transports,
new ESSink()));
卷曲索引ES:
curl --request PUT --url http://localhost:9200/twitter-bd
卷曲映射ES:
curl --request PUT
--url http://localhost:9200/twitter-bd/_mapping/twitter-wordcount \
--header 'content-type: application/json' \
--data '{
"twitter-wordcount": {
"properties": {
"word": {"type": "string"},
"cnt": {"type": "integer"}
}
}
}'
从您的主机,elasticsearch可在localhost:9300,也许你应该地址更改为localhost: transports.add(新的InetSocketAddress(InetAddress.getByName( “本地主机” ),9300)); – Antoine