报错内容
Exception in thread “main” NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{pTlI0YXAT5e1w5rwVEcNrw}{49.235.39.184}{49.235.39.184:9300}]]
或
org.elasticsearch.hadoop.rest.EsHadoopNoNodesLeftException: Connection error (check network and/or proxy settings)- all nodes faile]]
我的网络情况
公网ip:49.235.39.184
内网ip:172.17.0.5
服务器配置
- 修改hosts中的配置
[root@gui ~]# vi /etc/hosts
内网ip 主机名
2.修改Elasticsearch中config下的elasticsearch.yml
[root@gui config]# vi elasticsearch.yml
参数配置如下:
discovery.zen.ping.unicast.hosts: ["0.0.0.0"]
http.port: 9200
network.bind_host: 0.0.0.0
network.publish_host: 49.235.39.184
- 在云服务器上配置安全组,放通全部端口(关键)
idea中的配置
- spark写入数据到ES中的参数参数配置:
此处配置公网ip
最后运行程序,数据写入成功!