使用ES-Hadoop进行Hive和ES数据同步

本文介绍了如何在Hadoop、Hive和Elasticsearch环境中,使用ES-Hadoop进行数据同步。详细阐述了环境配置、操作步骤及遇到的常见错误,如大小写不敏感问题、缺失的Credentials类、无法检测ES版本和ClassCastException,并提供了相应的解决办法。总结指出,Hive的创建、删除和修改仅影响Hive层面,对ES需独立操作以确保数据一致性。
摘要由CSDN通过智能技术生成

一、环境说明

Elasticsearch 7.10.0

Hive 3.1.2

Hadoop 3.X

二、操作步骤

  1. 下载ES-Hadoop安装包,其版本需要与Elasticsearch实例保持一致,下载地址:https://www.elastic.co/cn/downloads/
    在这里插入图片描述

​ 本文中下载的是 :elasticsearch-hadoop-7.10.0.zip
在这里插入图片描述

  1. 解压已下载的elasticsearch-hadoop-7.10.0.zip,并将elasticsearch-hadoop-hive-7.10.0.jar上传至大数据集群
    比如我将jar包上传至hdfs的/user/hive/elastic/目录下:
#创建目录:
hdfs dfs -mkdir /user/hive/elastic
#上传jar包
hdfs dfs -put elasticsearch-hadoop-hive-7.10.0.jar /user/hive/elastic/
#查看
hdfs dfs -ls /user/hive/elastic
  1. hive添加jar 引用
hive>add jar hdfs://cluster/user/hive/elastic/elasticsearch-hadoop-hive-7.10.0.jar;

在这里插入图片描述

  1. 创建外部表
CREATE TABLE  ods.ods_es_hive_da (
  id  bigint ,
  createdtime bigint,
  customerdrugname string,
  customerhciname string,
  drugname string
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小狼躲藏

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值