赞
踩
目标: 从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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。