如何在cloudera quickstart VM中创建kudu表

时间:2018-05-19 21:17:56

标签: cloudera impala cloudera-quickstart-vm apache-kudu

我一直在尝试使用cloudera quickstart VM在impala中创建一个kudu表 https://kudu.apache.org/docs/quickstart.html

    CREATE TABLE sfmta
PRIMARY KEY (report_time, vehicle_tag)
PARTITION BY HASH(report_time) PARTITIONS 8
STORED AS KUDU
AS SELECT
  UNIX_TIMESTAMP(report_time,  'MM/dd/yyyy HH:mm:ss') AS report_time,
  vehicle_tag,
  longitude,
  latitude,
  speed,
  heading
FROM sfmta_raw;

收到以下错误:

错误:AnalysisException:表属性' kudu.master_addresses'不使用impalad启动标志-kudu_master_hosts时是必需的。使用的VM是cloudera-quickstart-vm-5.13.0-0-virtualbox。在此先感谢您的帮助

1 个答案:

答案 0 :(得分:0)

来自文档

  

如果未设置-kudu_master_hosts配置属性,则可以   仍然通过指定a来关联每个表的适当值   CREATE TABLE中的TBLPROPERTIES(' kudu.master_addresses')子句   声明或更改TBLPROPERTIES(' kudu.master_addresses')值   使用ALTER TABLE语句。

所以你的表创建应该是

 CREATE TABLE sfmta
PRIMARY KEY (report_time, vehicle_tag)
PARTITION BY HASH(report_time) PARTITIONS 8
STORED AS KUDU
TBLPROPERTIES ('kudu.master_addresses'='localhost:7051') 
AS SELECT
  UNIX_TIMESTAMP(report_time,  'MM/dd/yyyy HH:mm:ss') AS report_time,
  vehicle_tag,
  longitude,
  latitude,
  speed,
  heading
FROM sfmta_raw;

7051是kudu master的默认端口。