当前位置:   article > 正文

flink 写入到es_Flink从入门到真香(十、Sink数据输出-Elasticsearch)

flink sink es

目标: 从txt文件中读取数据,写入es,我这里用的es7.9,若是用的es7以前的版本下面代码中有个.type("_doc") 类别须要设置java

若是没有es和kibana(可选)环境能够先安装apache

安装es7

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-x86_64.rpm

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-x86_64.rpm.sha512

shasum -a 512 -c elasticsearch-7.9.3-x86_64.rpm.sha512

sudo rpm --install elasticsearch-7.9.3-x86_64.rpm

systemctl restart elasticsearch

安装kibana (可选,若是不想界面操做就能够不用装)

wget https://artifacts.elastic.co/downloads/kibana/kibana-7.9.3-x86_64.rpm

sudo rpm --install kibana-7.9.3-x86_64.rpm

systemctl start kibana

先引入Elasticsearch的pom依赖api

org.apache.flink

flink-connector-elasticsearch7_2.12

1.10.1

新建一个ElasticsearchSinkTest.scala服务器

package com.mafei.sinktest

import java.ut

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/606504
推荐阅读
相关标签
  

闽ICP备14008679号