java - 从elasticsearch连接并读取数据到hive
问题描述
我想将配置单元连接到弹性搜索。我按照这里的说明进行操作。我执行以下步骤
1. start-dfs.sh
2. start-yarn.sh
3. launch elasticsearch
4. launch kibana
5. launch hive
inside hive
a- create a database
b- create a table
c- load data into the table (LOAD DATA LOCAL INPATH '/home/myuser/Documents/datacsv/myfile.csv' OVERWRITE INTO TABLE students; )
d- add jar /home/myuser/elasticsearch-hadoop-7.10.1/dist/elasticsearch-hadoop-hive-7.10.1.jar
e- create a table for Elastic.
create table students_es (stt int not null, mahocvien varchar(10), tenho string, ten string, namsinh date, gioitinh string, noisinh string, namvaodang date, trinhdochuyenmon string, hesoluong float, phucaptrachnhiem float, chucvudct string, chucdqh string, dienuutien int, ghichu int) STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.nodes' = '127.0.0.1', 'es.port' = '9201', 'es.resource' = 'students/student');
f- insert overwrite table students_es select * from students;
然后我得到的错误如下
FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. org/apache/commons/httpclient/protocol/ProtocolSocketFactory
我使用了组件 kibana: 7.10.1 hive: 3.1.2 hadoop: 3.1.2
解决方案
我终于找到了解决方法。您需要下载 jar 文件 commons-httpclient-3.1.jar 并将其放入您的 hive lib 目录中。
推荐阅读
- microsoft-teams - 使用 GraphAPI 创建私有通道
- xamarin - Xamarin.Forms Android 应用程序在 web 视图返回导航后崩溃
- c# - C#如何观察深度嵌套的分层对象?
- javascript - 右侧 0% 到 -100% 的侧边栏无法隐藏
- c++ - 仅当 cin 后面有 cout 时,代码才有效 - C++
- java - 如何在部署在 heroku 上的 react 应用程序中配置 web 服务 url 以访问也部署在 heroku 中的 java REST web 服务
- python - TfIdfVectorizer 未正确标记
- r - 如何在函数中使用 char 变量来过滤 data.table 中的列?
- c++ - C++ | printf 双倍输出
- python - Python遍历嵌套列表以检查元素是否出现超过3次