


hive连接mysql数据库需要的驱动包,此包到网上下载

测试

hiveSQL是基于mapreduce和yarn的,所以yarn进程必须启动
建表语句说明:row format delimited fields terminated by '\t'
每行的分割标识为'\t'
登录mysql,到metastore库里查询刚才创建的表
select * from TBLS
为了查询时,显示列名,可以继续在hive-site.xml中配置.

这些参数都可以在hive-default.xml中找到,copy
最后的的配置
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://bigdata-pro03.kfk.com/metastore?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>bigdata-pro01.kfk.com,bigdata-pro02.kfk.com,bigdata-pro03.kfk.com</value>
</property>
网友评论