我正在使用蜂箱和钻头。
Storage Plugin info:
{
"type": "hive",
"enabled": true,
"configProps": {
"hive.metastore.uris": "",
"javax.jdo.option.ConnectionURL": "jdbc:mysql://localhost:3306/metastore_hive",
"javax.jdo.option.ConnectionDriverName": "com.mysql.jdbc.Driver",
"javax.jdo.option.ConnectionUserName": "root",
"javax.jdo.option.ConnectionPassword": "root",
"hive.metastore.warehouse.dir": "/user/hive/warehouse",
"fs.default.name": "file:///",
"hive.metastore.sasl.enabled": "false"
}
}
查询和所有的工作都很好。
然后我想检查一下它是否会自动发现hive中新创建的表
我在嵌入式模式下开始钻,并使用特定的数据库在hive使用
use hive.testDB;
这里testDB
是Hive中的数据库,表t1
&t2
。然后我查询:
show tables;
表名
t1
t2
我在hive中创建了一个表t3
,并在Drill中再次触发show tables;
。它仍然显示t1 t2
。5-10分钟后,我再次启动show tables;
,显示t1 t2 t3
。
我认为在hive中添加t3
后应该立即显示t3
。
这种行为的原因是什么? drill内部是如何处理的?
我在Drill的社区问了同样的问题& &;找到它的解决方案:
Drill在其HiveMetaStoreClient中使用缓存,以减少访问HiveMetaStore的开销。缺省情况下,cache的生存时间为60秒。
这个问题已经解决了。该问题包含在Drill 1.5中。缓存的生存时间可以通过配置hive存储插件来缩短。
如果你想使缓存TTL更短,你可以配置hive存储插件。
示例hive插件 (缓存ttl 5秒):
"configProps": {
"hive.metastore.uris": "thrift://hive.ip.address.com:9083",
... // other setting,
"hive.metastore.cache-ttl-seconds": "5",
"hive.metastore.cache-expire-after": "access"
}