Spark应用程序无法写入docker中运行的elasticsearch集群
我有一个在127.0.0.1:9200上收听的elasticsearch docker镜像,我使用sense和kibana进行了testing,工作正常,我能够索引和查询文档。 现在,当我尝试从火花App写入它
val sparkConf = new SparkConf().setAppName("ES").setMaster("local") sparkConf.set("es.index.auto.create", "true") sparkConf.set("es.nodes", "127.0.0.1") sparkConf.set("es.port", "9200") sparkConf.set("es.resource", "spark/docs") val sc = new SparkContext(sparkConf) val sqlContext = new SQLContext(sc) val numbers = Map("one" -> 1, "two" -> 2, "three" -> 3) val airports = Map("arrival" -> "Otopeni", "SFO" -> "San Fran") val rdd = sc.parallelize(Seq(numbers, airports)) rdd.saveToEs("spark/docs")
它无法连接,并继续重试
16/07/11 17:20:07 INFO HttpMethodDirector: I/O exception (java.net.ConnectException) caught when processing request: Operation timed out 16/07/11 17:20:07 INFO HttpMethodDirector: Retrying request
我尝试使用docker检查弹性search图像给出的IPAddress,这也不起作用。 但是,当我使用弹性search的本机安装时,Spark App运行正常。 有任何想法吗?
夫妇的事情,我会检查:
-
您正在使用的Elasticsearch-Hadoop火花连接器版本。 确保它不是testing版。 有一个固定的错误与IP解决有关。
-
由于9200是默认端口,因此可以删除以下行:
sparkConf.set("es.port", "9200")
并检查。 -
检查在您的Spark环境或configuration文件中没有configuration代理。
-
我假设你在同一台机器上运行Elasticsaerch和Spark。 你可以尝试configuration你的机器IP地址而不是127.0.0.1
希望这可以帮助! 🙂
- 如何将Docker镜像从Docker Hub部署到Azure ACS?
- swift 3.1.1.-release on linux copyItem(atPath:toPath :)尚未实现
- 将目录挂载到Windows 10上的Docker中
- Kubernetes荚随机超时
- 用启动脚本build立docker容器
- IntelliJ IDEA或Eclipse可以在一个操作系统上运行UI,但是在另一个操作系统的容器上编译 – 生成 – 执行?
- 为什么官方的SQL Server Express容器只能用于开发和testing?
- 任何有关在docker集装箱运行普罗米修斯的build议?
- 即使退出Docker后,如何使服务运行?