准备工作
我们假设你下载的StreamingPro包在/tmp目录下。
复制如下模板
{ "esToCsv": { "desc": "测试", "strategy": "streaming.core.strategy.SparkStreamingStrategy", "algorithm": [], "ref": [], "compositor": [ { "name": "streaming.core.compositor.spark.source.SQLSourceCompositor", "params": [ { "format": "org.elasticsearch.spark.sql", "path": "索引名称", "es.nodes": "这里是填写集群地址哈", "es.mapping.date.rich": "false" } ] }, { "name": "streaming.core.compositor.spark.transformation.JSONTableCompositor", "params": [ { "tableName": "table1" } ] }, { "name": "streaming.core.compositor.spark.transformation.SQLCompositor", "params": [ { "sql": "select * from table1" } ] }, { "name": "streaming.core.compositor.spark.output.SQLOutputCompositor", "params": [ { "format": "com.databricks.spark.csv", "path": "file:///tmp/csv-table1", "header": "true", "inferSchema": "true" } ] } ], "configParams": { } } }
假设该文件所在路径是 /tmp/esToCSV.json。
本机运行
cd $SPARK_HOME./bin/spark-submit --class streaming.core.StreamingApp \ --master local[2] \ --name test \ /tmp/streamingpro-0.3.2-SNAPSHOT-online-1.6.1.jar \ -streaming.name test \ -streaming.platform spark \ -streaming.job.file.path file:// /tmp/esToCSV.json
在集群运行
cd $SPARK_HOME./bin/spark-submit --class streaming.core.StreamingApp \ --master yarn-cluster\ --name test \ /tmp/streamingpro-0.3.2-SNAPSHOT-online-1.6.1.jar \ -streaming.name test \ -streaming.platform spark \ -streaming.job.file.path hdfs://clusternameAndPort/tmp/esToCSV.json
作者:祝威廉
链接:https://www.jianshu.com/p/18f949ff1409
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦