赞
踩
tar -zxvf apache-hive-2.3.6-bin.tar.gz -C /software
mv apache-hive-2.3.6-bin hive
4. 配置环境变量(路径/etc 文件名:profile)
#hive
export HIVE_HOME=/software/hive
export PATH=$PATH:$HIVE_HOME/bin
配置完成后使用命令source /etc/profile刷新文件
路径:/software/hive/conf
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</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>datanucleus.schema.autoCreateAll</name>
<value>true</value>
</property>
</configuration>
3. 下载mysql-connector-java-5.1.27,下载地址为https://downloads.mysql.com/archives/c-j/
将该文件解压,解压后文件夹中的mysql-connector-java-5.1.27-bin.jar拷贝至/software/hive/lib文件夹中
4. 启动Hadoop
sbin/start-all.sh
路径为安装Hadoop的路径,再检测Yarn和HDFS是否启动,命令为jps
bin/hadoop fs -mkdir /tmp
bin/hadoop fs -mkdir -p /user/hive/warehouse
bin/hadoop fs -chmod g+w /tmp
bin/hadoop fs -chmod g+w /user/hive/warehouse
在HDFS上查询
6. 初始化数据库
schematool -dbType mysql -initSchema
7. 启动hive,查询数据库
注:MySQL要授予远程登陆权限
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。