单独安装hive
使用Derby数据库的安装方式
什么是Derby安装方式
•Apache Derby是一个完全用java编写的数据库,所以可以跨平台,但需要在JVM中运行
•Derby是一个Open source的产品,基于Apache License 2.0分发
•即将元数据存储在Derby数据库中,也是Hive默认的安装方式
安装Hive
•解压Hive
- tar zxvf hive-0.8.1.tar /home/test/Desktop
•建立软连接
- ln –s hive-0.8.1 hive
•添加环境变量
- •export HIVE_HOME=/home/test/Desktop/hive
- •export PATH=….HIVE_HOME/bin:$PATH:.
配置Hive
•进入hive/conf目录
•依据hive-env.sh.template,创建hive-env.sh文件
- cp hive-env.sh.template hive-env.sh
•修改hive-env.sh
•指定hive配置文件的路径
- export HIVE_CONF_DIR=/home/test/Desktop/hive/conf
•指定Hadoop路径
- HADOOP_HOME=/home/test/Desktop/hadoop
hive-site.xml
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:derby:;databaseName=metastore_db;create=true</value>
- <description>JDBC connect string for a JDBC metastore</description>
- </property>
- <property>
- <name>javax.jdo.option.ConnectionDriverName</name>
- <value>org.apache.derby.jdbc.EmbeddedDriver</value>
- <description>Driver class name for a JDBC metastore</description>
- </property>
- <property>
- <name>javax.jdo.option.ConnectionUserName</name>
- <value>APP</value>
- <description>username to use against metastore database</description>
- </property>
- <property>
- <name>javax.jdo.option.ConnectionPassword</name>
- <value>mine</value>
- <description>password to use against metastore database</description>
- </property>
启动Hive
•命令行键入
•Hive
•显示
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/test/Desktop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/test/hive_job_log_test_201208260529_167273830.txt
hive>
测试语句
•建立测试表test
•create table test (key string);
•show tables;