hadoop@ubuntu:/usr/local/hadoop/hive$ mkdir /usr/local/hadoop/hive/warehouse
hadoop@ubuntu:/usr/local/hadoop/hive$ mkdir /usr/local/hadoop/hive/log
vim hive-site.xml,需要修改三处:
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
#临时文件目录,这个没有可以添加进去
hive.exec.scratdir
/usr/local/hadoop/hive/tmp
#存放hive相关日志的目录
hive.querylog.location
/usr/local/hadoop/hive/log
Location of Hive run time structured log file
其余的使用默认的就行。
还有一个重要的修改,否则启动会报警告
hadoop@ubuntu:/usr/local/hadoop/hive$ bin/hive
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
解决的办法就是在 hive-log4j.properties 中将 log4j.appender.EventCounter 的值修改为
org.apache.hadoop.log.metrics.EventCounter,这样就不会报。该文件同样在目录HIVE_HOME/conf下面。 4.启动hive
hadoop@ubuntu:/usr/local/hadoop/hive$ bin/hive
hadoop@ubuntu:/usr/local/hadoop/hive$ hive> show tables;
下面是配置mysql模式下的Hive 1.为mysql专门为hive添加用户
mysql> CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost' WITH GRANT OPTION; 2.修改配置文件hive-site.xml
hive.metastore.local
true
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:3306/hive?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 to use against metastore database
javax.jdo.option.ConnectionPassword
hive
password to use against metastore database