drill1.0配置hive storage plugin及測試
drill,hive
截止到目前本部落格釋出前,apache drill最新釋出版本是1.0.0,對與此版本的資料源支援和檔案格式的支援:
- avro
- parquet
- hive
- hbase
- csv tsv psv
-
File system
對于目前我的需求:snappy+sequencefile 的hdfs存儲格式,drill沒有直接的支援,想到hive支援查詢snappy+sequencefile,而drill支援hive,由此産生了是否可以通過hive storage plugin的方式來讀取snappy+sequencefile? 經查證是可以的,配置如下:
- hive開啟metastore的thrift服務:在hive-site.xml中加入如下配置
-
<property>
-
<name>hive.metastore.uris</name>
-
<value>thrift://10.170.250.47:9083</value>
-
</property>
-
<property>
-
<name>hive.metastore.local</name>
-
<value>false</value>
-
</property>
-
-
[[email protected] local]$ ../hive-1.2.1/bin/hive --service metastore &
- 從drill的web ui上配置hive的plugin:
-
{
-
"type":"hive",
-
"enabled":true,
-
"configProps":{
-
"hive.metastore.uris":"thrift://10.170.250.47:9083",#hive的metastore服務位址和端口
-
"javax.jdo.option.ConnectionURL":"jdbc:mysql://xxx:3306/hive_database",
-
"hive.metastore.warehouse.dir":"/user/hive/warehouse",#為hive在hdfs上的warehouse目錄
-
"fs.default.name":"hdfs://xxx:9000",
-
"hive.metastore.sasl.enabled":"false"
-
}
-
}
-
-
[[email protected] drill-1.1.0]$ bin/drillbit.sh restart
-
```
-
3. 查詢sequencefile測試:
-
``` shell
-
[[email protected] drill-1.1.0]$ bin/sqlline -u jdbc:drill:zk=10.172.171.229:2181
-
apache drill 1.0.0
-
"the only truly happy people are children, the creative minority and drill users"
-
0: jdbc:drill:zk=10.172.171.229:2181>use hive.ai;
-
+-------+--------------------------------------+
-
| ok | summary |
-
+-------+--------------------------------------+
-
|true|Default schema changed to [hive.ai]|
-
+-------+--------------------------------------+
-
1 row selected (0.188 seconds)
-
0: jdbc:drill:zk=10.172.171.229:2181>!table
-
+------------+---------------------+---------------------+-------------+----------+-----------+-------------+------------+----------------------------+-----------------+
-
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION |
-
+------------+---------------------+---------------------+-------------+----------+-----------+-------------+------------+----------------------------+-----------------+
-
| DRILL | INFORMATION_SCHEMA | CATALOGS | TABLE |||||||
-
| DRILL | INFORMATION_SCHEMA | COLUMNS | TABLE |||||||
-
| DRILL | INFORMATION_SCHEMA | SCHEMATA | TABLE |||||||
-
| DRILL | INFORMATION_SCHEMA | TABLES | TABLE |||||||
-
| DRILL | INFORMATION_SCHEMA | VIEWS | TABLE |||||||
-
| DRILL | hive.ai | metric_data_entity | TABLE |||||||
-
| DRILL | sys | boot | TABLE |||||||
-
| DRILL | sys | drillbits | TABLE |||||||
-
| DRILL | sys | memory | TABLE |||||||
-
| DRILL | sys | options | TABLE |||||||
-
| DRILL | sys | threads | TABLE |||||||
-
| DRILL | sys | version | TABLE |||||||
-
+------------+---------------------+---------------------+-------------+----------+-----------+-------------+------------+----------------------------+-----------------+
-
0: jdbc:drill:zk=10.172.171.229:2181> SELECT count(1) FROM metric_data_entity where pt='2015080510';
-
+-----------+
-
| EXPR$0 |
-
+-----------+
-
|40455402|
-
+-----------+
-
1 row selected (14.482 seconds)
-
0: jdbc:drill:zk=10.172.171.229:2181>
-
```
-
以上查詢已經可以支援sequencefile查詢,但是查詢有壓縮的snappy的檔案就報錯:
-
```
-
2015-08-0516:34:49,067[WorkManager-2] ERROR o.apache.drill.exec.work.WorkManager- org.apache.drill.exec.work.WorkManager$WorkerBee$1.run() leaked an exce
-
ption.
-
java.lang.UnsatisfiedLinkError: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z
-
at org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy(NativeMethod)
-
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)~[na:1.7.0_85]
-
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[na:1.7.0_85]
-
at java.lang.Thread.run(Thread.java:745)[na:1.7.0_85]
-
2015-08-0516:39:05,781[UserServer-1] INFO o.a.drill.exec.work.foreman.Foreman-State change requested. RUNNING --> CANCELLATION_REQUESTED
- hive開啟metastore的thrift服務:在hive-site.xml中加入如下配置
- 配置LD_LIBRARY_PATH=/oneapm/local/hadoop-2.7.1/lib/native的 系統環境變量 并加入到CLASSPATH中
參考文獻: https://drill.apache.org/docs/hive-storage-plugin/ https://gist.github.com/vicenteg/7e060e79603f1e7ed3b4 http://blog.csdn.net/reesun/article/details/8556078