Integrating Impala with Kudu allows you to access data tables in Kudu. This topic describes how to integrate Impala with Kudu.
Prerequisites
You have created a cluster and selected the Impala and Kudu services. For more information, see Create a cluster.
Procedure
Console
-
On the Impala service's Configure page, add the following configuration items. For more information, see Manage configuration items.
-
On the Impala service's Configure page, click the impalad.flgs tab.
-
On the impalad.flgs tab, click Add Configuration Item. Add a parameter named kudu_master_hosts with a value of master-1-1:7051.
Notekudu_master_hosts specifies the master nodes and port numbers of the Kudu cluster that Impala connects to. If there are multiple master nodes, you can separate them with a comma (,). For example, master-1-1:7051,master-1-2:7051,master-1-3:7051.
-
On the catalogd.flgs tab, click Add Configuration Item. Add a parameter named kudu_master_hosts with a value of master-1-1:7051.
-
-
Optional: Log in to the cluster to verify the integration.
-
Connect to Impala. For more information, see Impala shell tool.
-
Run the following command to create a table:
create table my_first_table ( id bigint, name string, primary key(id) ) partition by hash partitions 16 stored as kudu tblproperties( 'kudu.num_tablet_replicas' = '1');The message
Table has been created.indicates that the table was created successfully.
-
CLI
-
Connect to Impala. For more information, see Impala shell tool.
-
Run the following command to create a table.
Use the
kudu.master_addressesproperty to specify the Kudu cluster, as shown in the following example:create table my_first_table ( id bigint, name string, primary key(id) ) partition by hash partitions 16 stored as kudu tblproperties( 'kudu.master_addresses' = 'master-1-1:7051', 'kudu.num_tablet_replicas' = '1');NoteParameter descriptions:
-
my_first_table: The name of the table. You can specify a custom name. -
kudu.master_addresses: Specifies the master nodes. If the cluster has multiple master nodes, separate their addresses with commas (,). For example,master-1-1:7051,master-1-2:7051,master-1-3:7051. For a Hadoop cluster, set the value toemr-header-1.
The message
Table has been created.indicates that the table was created successfully. -
-
Optional: Run the following command to insert data into the table:
insert into my_first_table values(1,"ss"); -
Optional: Run the following command to query data from the table:
select * from my_first_table;The command returns the following output:
+----+------+ | id | name | +----+------+ | 1 | ss | +----+------+NoteTo drop the table, run
drop table my_first_table;.