[hadoop@master conf]$ vi hive-env.sh ##主要的配置内容如下: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <property> <name>hive.metastore.warehouse.dir</name> <value>/data/hive-1.1.0-cdh5.5.0/hive-db/warehouse</value> <description>location of default database for the warehouse</description> </property> <property> <name>hive.exec.scratchdir</name> <value>/data/hive-1.1.0-cdh5.5.0/tmp/hive-${user.name}</value> <description>Scratch space for Hive jobs</description> </property> <property> <name>hive.exec.local.scratchdir</name> <value>/data/hive-1.1.0-cdh5.5.0/tmp/${user.name}</value> <description>Local scratch space for Hive jobs</description> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/data/hive-1.1.0-cdh5.5.0/downloaded</value> <description> Temporary local directory for added resources in the remote file system. </description> </property> <property> <name>hive.querylog.location</name> <value>/data/hive-1.1.0-cdh5.5.0/queryLogs/${user.name}</value> <description>Location of Hive run time structured log file</description> </property> <property> <name>javax.jdo.option.ConnectionURL</name> <value> jdbc:mysql://slave1:3306/hive?useUnicode=true&characterEncoding=utf8 </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>hive</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hive</value> <description>password to use against metastore database</description> </property>
[hadoop@master ~]$ cd ~/bigdataspace/hive-1.1.0-cdh5.5.0 [hadoop@master hive-1.1.0-cdh5.5.0]$ ./bin/hive --service metastore &
1.6启动/停止hive (CTL)命令行
1 2 3 4 5 6
#因为一开始配置了HIVE_HOME环境变量,可以直接在任何目录下执行hive命令了,进入hive控制台 [hadoop@master bigdataspace]$ hive Logging initialized using configuration in jar:file:/home/hadoop/bigdataspace /hive-1.1.0-cdh5.5.0/lib/hive-common-1.1.0-cdh5.5.0.jar!/hive-log4j.properties WARNING: Hive CLI is deprecated and migration to Beeline is recommended. hive (default)>
上面报错了,解决Logging initialized using configuration in jar:file… (因为没log配置文件,直接从jar包查找)
1 2 3 4 5 6 7 8 9 10 11
$cd ~/bigdataspace/ /hive-1.1.0-cdh5.5.0/conf $ cp beeline-log4j.properties.template beeline-log4j.properties $ cp hive-log4j.properties.template hive-log4j.properties $ cp hive-exec-log4j.properties.template hive-exec-log4j.properties [hadoop@master bigdataspace]$ hive Logging initialized using configuration in file:/home/hadoop/bigdataspace/ hive-1.1.0-cdh5.5.0/conf/hive-log4j.properties WARNING: Hive CLI is deprecated and migration to Beeline is recommended. hive (default)>