Spark integration ElasticSearch
来源:互联网 发布:棕色牛津鞋搭配 知乎 编辑:程序博客网 时间:2024/06/05 22:49
用Spark Streaming 从AWS 的kinesis (类似Kafka) 中读取streaming data, 然后通过spark 计算框架处理之后write into ElasticSearch , spark 写:数据到elasticsearch 有两种方式, 下面是integration 的过程:
需要的packages org.elasticsearch:elasticsearch-spark-20_2.11 [版本spark2.0, 2.11]download
spark 写入ElasticSearch 的两种方式
- rdd 直接写入ES 或者dataframe 直接写入ES:
def dataframe_write_to_es(dataframe): dataframe.write.format("org.elasticsearch.spark.sql")\ .option("es.nodes", "http://elasticsearch_domain")\ .option("es.port", 443)\ .option("es.nodes.wan.only", "true")\ .option("es.nodes.discovery", "false")\ .option("es.net.ssl", "true")\ .option("es.mapping.routing", "id_xxx")\ .save(es_index, mode="append")def rdd_write_to_es(rdd): conf = {"es.nodes": "http://elasticsearch_domain", "es.port": "80", "es.nodes.wan.only": "true", "es.nodes.discovery": "false", "es.mapping.routing": "xxx", "es.batch.size.bytes": "30mb", "es.batch.size.entries": "300000", "es.resource": index/type} rdd .saveAsNewAPIHadoopFile(path='-', outputFormatClass="org.elasticsearch.hadoop.mr.EsOutputFormat", keyClass="org.apache.hadoop.io.NullWritable", valueClass="org.elasticsearch.hadoop.mr.LinkedMapWritable", conf=conf)
以上conf 可以reference elasticsearch-hadoop-configuration
- rdd 直接写入ES 或者dataframe 直接写入ES:
阅读全文
0 0
- Spark integration ElasticSearch
- spark&hbase integration
- Spark Streaming + Flume Integration Guide
- Spark thriftserver连elasticsearch
- Elasticsearch-Spark 体验
- apache spark 结合 elasticsearch
- spark与elasticsearch整合
- spark查询elasticsearch
- spark导入elasticsearch
- Spark操作ElasticSearch
- elasticSearch spark支持
- GraphLab Integration with Spark Open Source Release
- spark中读取elasticsearch数据
- 使用spark与ElasticSearch交互
- spark和elasticsearch的整合
- Integration
- spark-sql与elasticsearch整合&测试
- 使用spark访问elasticsearch的数据
- java最实用newFixedThreadPool线程池
- Android7.0中文文档(API)--- TabHost
- openstack-network-instances
- django中出现莫名其妙奇妙的错误,发现是python版本的问题
- python中序列、列表的使用
- Spark integration ElasticSearch
- caffe添加新层教程
- opencv在输出不同文件格式输出的时候文件空间的大小不一样
- cmake学习
- C#控制格式符
- eclipse关闭Updating Error Reporting Database
- PHPCMS V9两步实现修改后台管理登陆路径方法分享
- SSD:Single Shot MultiBox Detector 详解
- Devops 前途无量