clickhouse集群对接hive(三)

九月2年前技术文章759

前提:集群中已经部署了hive组件和clickhouse集群,clickhouse集群进行对接hive

1、设置hdfs文件系统本地缓存

<local_cache_for_remote_fs>
    <enable>true</enable>
    <root_dir>local_cache</root_dir>
    <limit_size>559096952</limit_size>
    <bytes_read_before_flush>1048576</bytes_read_before_flush>
</local_cache_for_remote_fs>

1.png

2、在hive中创建orc的表

user use test;
CREATE TABLE `test`.`test_orc`(
  `f_tinyint` tinyint, 
  `f_smallint` smallint, 
  `f_int` int, 
  `f_integer` int, 
  `f_bigint` bigint, 
  `f_float` float, 
  `f_double` double, 
  `f_decimal` decimal(10,0), 
  `f_timestamp` timestamp, 
  `f_date` date, 
  `f_string` string, 
  `f_varchar` String,
  `f_bool` boolean, 
  `f_binary` binary, 
  `f_array_int` array<int>, 
  `f_array_string` array<string>, 
  `f_array_float` array<float>, 
  `f_array_array_int` array<array<int>>, 
  `f_array_array_string` array<array<string>>, 
  `f_array_array_float` array<array<float>>)
  PARTITIONED BY ( 
  `day` string)
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.ql.io.orc.OrcSerde' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION
  'hdfs://mycluster/user/hive/warehouse/test.db/test_orc';
  
insert into test.test_orc partition(day='2021-09-18') select 1, 2, 3, 4, 5, 6.11, 7.22, 8.333, current_timestamp(), current_date(),'hello world', 'hello world',  true, 'hello world', array(1, 2, 3), array('hello world', 'hello world'), array(float(1.1), float(1.2)), array(array(1, 2), array(3, 4)), array(array('a', 'b'), array('c', 'd')), array(array(float(1.11), float(2.22)), array(float(3.33), float(4.44)));

2.png

在clickhouse中创建表

CREATE TABLE test.test_orc
(
    `f_tinyint` Int8,
    `f_smallint` Int16,
    `f_int` Int32,
    `f_integer` Int32,
    `f_bigint` Int64,
    `f_float` Float32,
    `f_double` Float64,
    `f_decimal` Float64,
    `f_timestamp` DateTime,
    `f_date` Date,
    `f_string` String,
    `f_varchar` String,
    `f_bool` Bool,
    `f_binary` String,
    `f_array_int` Array(Int32),
    `f_array_string` Array(String),
    `f_array_float` Array(Float32),
    `f_array_array_int` Array(Array(Int32)),
    `f_array_array_string` Array(Array(String)),
    `f_array_array_float` Array(Array(Float32)),
    `day` String
)
ENGINE = Hive('thrift://172.16.121.0:9083', 'test', 'test_orc')
PARTITION BY day

SELECT * FROM test.test_orc settings input_format_orc_allow_missing_columns = 1\G

3.jpg



相关文章

 大数据集群监控配置操作指导(三)Flink监控开启jmx

大数据集群监控配置操作指导(三)Flink监控开启jmx

官网的关于 flnk+prometheus的文章https://flink.apache.org/features/2019/03/11/prometheus-monitoring.htmlprome...

MySQL运维实战之ProxySQL(9.9)proxysql自身高可用

MySQL运维实战之ProxySQL(9.9)proxysql自身高可用

proxysql作为一个程序,本身也可能出现故障。部署proxysql的服务器也肯能出现故障。高可用架构的一个基本原则是消除单点。可以在多个节点上部署proxysql,在proxysql之前再加一层负...

详解迁云流程

详解迁云流程

一、现有云端环境梳理可以通过阿里云工单申请导出网络架构图,在图的信息上梳理阿里云现有架构二、制定迁移方案根据梳理的信息,确定实例迁移的方案,有夸账号迁移,跨地域迁移,IDC上云等不同场景。需要考虑的是...

Datanode节点坏卷处理

Datanode节点坏卷处理

1、告知客户故障信息,确定是否有备用磁盘更换2、停止故障节点的所有角色服务3、卸载故障磁盘umount -vl /data64、等待硬件厂商更换好磁盘5、对新磁盘分区和格式化#1.磁盘分区 mkfs...

数据湖技术之iceberg(九)Spark与Iceberg整合写操作

数据湖技术之iceberg(九)Spark与Iceberg整合写操作

1. INSERT INTO"insert into"是向Iceberg表中插入数据,有两种语法形式:"INSERT INTO tbl VALUES (1,"z...

Docker 网络介绍

一、Docker 网络docker网络主要是解决容器联网问题,也是我们使用容器中最重要的一个环节,如果容器没有网络则无法向网络中提供服务。网络管理命令:docker network[root@zutu...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。