conf/hbase-env.sh (这里)
# The java implementation to use. Java 1.6 required.
export JAVA_HOME=/usr/jdk1.6.0_25
# Extra Java CLASSPATH elements. Optional.
export HBASE_CLASSPATH=/u01/app/hadoop/conf
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=true
MySQL存储元数据 (安装过程见这里)
创建数据库的时候,必须使用latin1作为字符集,否则会有错误信息Specified key was too long; max key length is 767 bytes
mysql> create database hivedb default character set latin1;
mysql> create user 'hive'@'localhost' identified by 'hive';
mysql> grant all on hivedb.* to 'hive'@'localhost';
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:3306/hivedb?createDatabaseIfNotExist=true
JDBC connect string FOR a JDBC metastore
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
Driver class name FOR a JDBC metastore
javax.jdo.option.ConnectionUserName
hive
username TOUSE against metastore database
javax.jdo.option.ConnectionPassword
hive
password TOUSE against metastore database
MySQL 驱动包
下载mysql-connector-java-5.1.18-bin.jar文件,并放到$HIVE_HOME/lib目录下
测试
hadoop@ubuntu02:/u01/app/hive$ bin/hive
Logging initialized using configuration in jar:file:/u01/app/hive-0.8.1-bin/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/hadoop/hive_job_log_hadoop_201203201733_2122821776.txt
hive> show tables;
OK
tb
Time taken: 2.458 seconds
hive>