Apache spark 使用PySpark将数据从HDFS索引到弹性搜索
我正在尝试使用Pyspark将数据索引到HDFS中的弹性搜索。当数据大于50MB小于100MB时,作业将失败 有人能告诉我如何优化流程吗?我有四个节点的ES集群,每个都有4g堆 例外情况如下:Apache spark 使用PySpark将数据从HDFS索引到弹性搜索,apache-spark,
elasticsearch,pyspark,Apache Spark,
elasticsearch,Pyspark,我正在尝试使用Pyspark将数据索引到HDFS中的弹性搜索。当数据大于50MB小于100MB时,作业将失败 有人能告诉我如何优化流程吗?我有四个节点的ES集群,每个都有4g堆 例外情况如下: Caused by: org.apache.spark.util.TaskCompletionListenerException: Could not write all entries for bulk operation [1/1]. Error sample (first [5] error mes
Caused by: org.apache.spark.util.TaskCompletionListenerException: Could not write all entries for bulk operation [1/1]. Error sample (first [5] error messages):
org.elasticsearch.hadoop.rest.EsHadoopRemoteException: mapper_parsing_exception: failed to parse;org.elasticsearch.hadoop.rest.EsHadoopRemoteException: not_x_content_exception: not_x_content_exception: Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
{"index":{}}
我使用的脚本如下:
df = spark.read.csv("hdfs://xxxxxx:9000/SOMEPATH",mode="DROPMALFORMED", header=True)
df_1.write.format("org.elasticsearch.spark.sql").option('es.nodes', 'xxxxxx').option('es.port',9200).option("es.node","lb")\
.option("es.net.http.auth.user","xx").option("es.net.http.auth.pass","xx").option("es.input.json", "true")\
.option('es.batch.write.retry.wait','60s').option('es.batch.size.entries','100').option('es.batch.write.retry.count' ,'6').option('es.resource','xx/xy').save()
注意:我已经讨论了可能的解决方案,但在我的案例中没有任何效果
谢谢问题在于Pyspark的罐子。
如果我们使用Scala罐,它可以正常工作。因此,将我的管道代码更改为scala,它工作得非常完美。似乎是映射或格式化数据的问题--“只能对某些xcontent字节或压缩的xcontent字节调用压缩器检测”数据看起来也很好,即使创建了索引,但它也无法完成工作可能是这样,用Pypark连接ES的东西。我使用了与上面使用scala相同的方法,它像charmOK一样工作。然后创建了索引…那么…您是否有可能确定插入时哪个文档中断?…它是随机的,有时是22234,有时是194665