hive 0.11.0安装
使用mysql存储hive元数据
创建新的用户hive,密码也设为hive,并创建新的数据库名为hive,设定为latin1编码
赋予并刷新权限
grant all on hive.* to hive@'%' identified by 'hive';
grant all on hive.* to hive@'localhost' identified by 'hive';
flush privileges;
验证hive用户
mysql -uhive -phive
show databases;
把hive安装包解压到/usr/local/hive-0.11.0
添加环境变量
vi .bash_profile
导入下面的环境变量
export HIVE_HOME=/usr/local/hive-0.11.0
export PATH=$PATH:$HIVE_HOME/bin
使其有效
source .bash_profile
复制2份hive-default.xml.template,分别命名为hive-default.xml和hive-site.xml
修复hive-site.xml以下配置
<property>
<name>javax.jdo.option.ConnectionURL </name>
<value>jdbc:mysql://localhost:3306/hive </value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName </name>
<value>com.mysql.jdbc.Driver </value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>Username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword </name>
<value>hive </value>
</property>
拷贝mysql的驱动mysql-connector-java-5.1.6-bin.jar 到hive 的lib下面
执行hive命令
hive
测试输入 show database;
如果没把mysql驱动拷贝到lib目录,或者mysql服务未启动,则会报错
FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
使用mysql存储hive元数据
创建新的用户hive,密码也设为hive,并创建新的数据库名为hive,设定为latin1编码
赋予并刷新权限
grant all on hive.* to hive@'%' identified by 'hive';
grant all on hive.* to hive@'localhost' identified by 'hive';
flush privileges;
验证hive用户
mysql -uhive -phive
show databases;
把hive安装包解压到/usr/local/hive-0.11.0
添加环境变量
vi .bash_profile
导入下面的环境变量
export HIVE_HOME=/usr/local/hive-0.11.0
export PATH=$PATH:$HIVE_HOME/bin
使其有效
source .bash_profile
复制2份hive-default.xml.template,分别命名为hive-default.xml和hive-site.xml
修复hive-site.xml以下配置
<property>
<name>javax.jdo.option.ConnectionURL </name>
<value>jdbc:mysql://localhost:3306/hive </value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName </name>
<value>com.mysql.jdbc.Driver </value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>Username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword </name>
<value>hive </value>
</property>
拷贝mysql的驱动mysql-connector-java-5.1.6-bin.jar 到hive 的lib下面
执行hive命令
hive
测试输入 show database;
如果没把mysql驱动拷贝到lib目录,或者mysql服务未启动,则会报错
FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask