转自

How to run this app

Please follow the instructions below to get kudu running locally with java and impala driver.

Download the kudu quickstart VM

Kudu Quick Start VM

Create the department file to load

You can use this python script to create the department file to load: name it generate.py

#!/usr/local/bin/python3
default_path = '/Users/ryang1/Desktop'
def generateDepartmentMasterFile():"""Company Id | Department Code | Department Description"""file = open(default_path+'/dept.txt','a')for x in range (1,501):file.write('Company{0}|{0}|Dept{0}
Description\n'.format(str(x)))
generateDepartmentMasterFile()

Run it using

$ python3 generate.py

Load the department file

Start your kudu quickstart VM. Once it has started run this command to find the vm ip. Should start with 192.168.*

$ ip addr show
[demo@quickstart ~]$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
state UNKNOWNlink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
pfifo_fast state UP qlen 1000link/ether 08:00:27:8a:40:9a brd ff:ff:ff:ff:ff:ffinet 192.168.57.100/24 brd 192.168.57.255 scope global
eth0
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
pfifo_fast state UP qlen 1000link/ether 08:00:27:16:94:b5 brd ff:ff:ff:ff:ff:ffinet 10.0.3.15/24 brd 10.0.3.255 scope global eth1

Once you figure out your vm ip address, we will copy over the dept.txt file we created earlier with the python script and put it into hdfs.

ssh username:demo password:demo

$ scp dept.txt demo@192.168.57.100:~/
$ ssh demo@192.168.57.100
$ hdfs dfs -put -f dept.txt /data/dept

Create the department table in kudu/impala

CREATE EXTERNAL TABLE department_raw (company_id string,department_code int,department_description string)ROW FORMAT DELIMITEDFIELDS TERMINATED BY '|'LOCATION '/data/dept/';
CREATE TABLE department
DISTRIBUTE BY HASH (company_id) INTO 16 BUCKETS
TBLPROPERTIES(
'storage_handler' =
'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'department',
'kudu.master_addresses' = '127.0.0.1',
'kudu.key_columns' = 'company_id') AS SELECT * FROM department_raw;
# Set the database configuration

In the project search for src/main/java/config/DatabaseConfig.java and set the datasource url to your kudu/impala VM url

@Bean(name="dataSource")
public DataSource dataSource() {DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();//CHANGE ME!dataSourceBuilder.url("jdbc:impala://192.168.57.100:21050");dataSourceBuilder.username("demo");dataSourceBuilder.password("demo");dataSourceBuilder.driverClassName("com.cloudera.impala.jdbc4.Driver");return dataSourceBuilder.build();
}

Setting up intellij

In order to run the spring boot app you will need to set the run configuration Run -> Edit Configurations Press the + icon create a new maven entry name it to springboot-run change the command line input field to

spring-boot:run

hit apply/save.

You are all set. Hit run.

To see it in action go to your browser and visit url: http://localhost:8080/department?companyId=Company1

Springboot with Impala and Kudu相关推荐

  1. impala创建kudu表过程,并发时异常

    1.环境 impala版本2.11.0-cdh5.14.0,kudu版本2.11.0-cdh5.14.0 2.问题现象 最近使用impala+kudu时遇到个问题,有个程序会定时通过jdbc来创建ku ...

  2. java impala_Java实现impala操作kudu

    packagecn.itcast.impala.impala;import java.sql.*;public classContants {private static String JDBC_DR ...

  3. 未明确定义列存储过程没问题_使用Apache Kudu和Impala实现存储分层

    当为应用程序的数据选择一个存储系统时,我们通常会选择一个最适合我们业务场景的存储系统.对于快速更新和实时分析工作较多的场景,我们可能希望使用 Apache Kudu ,但是对于低成本的大规模可伸缩性场 ...

  4. 使用Apache Kudu和Impala实现存储分层

    为什么80%的码农都做不了架构师?>>>    当为应用程序的数据选择一个存储系统时,我们通常会选择一个最适合我们业务场景的存储系统.对于快速更新和实时分析工作较多的场景,我们可能希 ...

  5. KUDU和IMPALA的结合使用

    Kudu 与 Apache Impala紧密集成,允许使用 Impala 的 SQL 语法从 Kudu tablets 插入,查询,更新和删除数据.此外,还可以用 JDBC 或 ODBC, Impal ...

  6. Apache Kudu 与 Impala Shell 的结合使用文档(创建表、删、改、查)

    Kudu与Apache Impala紧密集成,允许您在Impala使用Impala的SQL语法从Kudu去做 插入,查询,更新和删除数据,作为使用Kudu API 构建自定义Kudu应用程序的替代方法 ...

  7. [Kudu基础]--Kudu+Impala介绍 | 微店数据科学团队博客

    感谢原文作者:https://juejin.im/entry/5a72d3d1f265da3e4d730b37 Kudu+Impala介绍 概述 Kudu和Impala均是Cloudera贡献给Apa ...

  8. kudu on impala 基本用法。

    好久没用kudu了 突然别的项目组开始用kudu,问各种问题,实在招架不住.... 于是自我学习一波. https://impala.apache.org/docs/build/impala-2.12 ...

  9. Kudu+Impala介绍

    概述 Kudu和Impala均是Cloudera贡献给Apache基金会的顶级项目.Kudu作为底层存储,在支持高并发低延迟kv查询的同时,还保持良好的Scan性能,该特性使得其理论上能够同时兼顾OL ...

  10. 【kudu pk parquet】TPC-H Query2对比解析

    这是[kudu pk parquet]的第二篇,query2在kudu和parquet上的对比解析,其中kudu包含有不能下发的谓词. 3台物理机,1T规模的数据集,impala和kudu版本是我们修 ...

最新文章

  1. 结课作业:云计算在物联网中的应用发展
  2. Binder通信模型 :ServiceManager
  3. 负载均衡下ajax第二次请求,会话清除第二个AJAX电话
  4. idea没法识别java文件,idea文件左下角有个j的符号并是黄色
  5. 嵌入式系统的知识体系、学习误区及学习建议
  6. Spring MVC生成PDF文件代码示例
  7. RUNOOB python练习题10
  8. 依赖注入例子php,依赖注入小例子
  9. [过年菜谱之]杭椒牛柳
  10. 为什么说Redis单线程效率高
  11. windows系统误删引导分区后如何重装系统
  12. java FreeMarker模板路径问题
  13. HDU 3221 Brute-force Algorithm(指数降幂公式)
  14. WordPress整合ckplayer X3视频播放器插件
  15. 网线水晶头接法(附图说明)
  16. 论文小技巧-pdf转eps使色彩保持RGB不变及去边框
  17. MCAL中MCU的配置
  18. mib2c : You didn‘t give mib2c a valid OID to start with.解决
  19. Sigar获取系统信息
  20. 20 w 新闻数据集分享

热门文章

  1. ICON源码复现(Implicit Clothed humans Obtained from Normals)
  2. Jenkins - Update information obtained: 不可用 ago;
  3. 戴尔台式计算机没声音,戴尔电脑没声音怎么回事?四个方法轻松解决
  4. 邹恒甫:谈点2002年后海鬼/龟和特聘教授的工资待遇和福利
  5. 使用SLT系统抽数到hana系统
  6. 学习笔记_循环语句的嵌套
  7. vue-cli-service build 如何环境设置,打出不同环境的包
  8. 服务器安装sata固态硬盘吗,SATA接口固态硬盘安装教程
  9. 一、pytorch环境配置
  10. 搭建网站服务器必须开443端口,记录解决网站443端口不通的问题(启动HTTP或者更换域名)...