标签:
先到官网下载hive的编译好的包。
我下载的是apache-hive-1.1.1-bin.tar.gz,hadoop版本是2.6,工作模式选择独立模式
mysql -uroot -e "CREATE USER ‘hive‘@‘%‘ IDENTIFIED BY ‘hive‘" mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO ‘hive‘@‘%‘ WITH GRANT OPTION" mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO ‘hive‘@‘localhost‘ IDENTIFIED BY ‘hive‘ WITH GRANT OPTION"
2. 解压安装
将apache-hive-1.1.1-bin.tar.gz解压hive到,/usr/local/ (如果不是用的root,解压到/home/指定用户下);
创建软连接;
下载mysql-connector-java-5.1.7-bin.jar,版本不一定跟我的一样;
修改权限;
将mysql-connector-java-5.1.7-bin.jar拷贝到hadoop目录下。
tar -zxf apache-hive-1.1.1-bin.tar.gz /usr/local/ ln -s /usr/local/apache-hive-1.1.1-bin /usr/local/hive cp mysql-connector-java-5.1.7-bin.jar /usr/local/hive/lib/ chown -R root.root /usr/local/hive/ cp -f /usr/local/hive/lib/jline-2.12.jar /usr/local/hadoop/share/hadoop/yarn/lib/jline-2.12.jar
3. 配置文件设置:
将hive-site.xml拷贝到hive的conf目录下,内容如下:
<?xml version="1.0" encoding="UTF-8"?> <!--Autogenerated by Cloudera Manager--> <configuration> <property> <name>hive.metastore.local</name> <value>true</value> </property> <property> <name>javax.jdo.option.ConnectionURl</name> <value>jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfotExist=true</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> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hive</value> </property> </configuration>
4. 设置环境变量:
vi ~/.bashrc
export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin
source ~/.bashrc
5. 安装完成可以测试验证了,输入hive命令进入hive的shell界面:
安装的过程中也遇到一些问题
启动hive时,报hive-site.xml格式错误,修改hive-site.xml
启动hive时,jline-2.12.jar版本问题,替换为新的
标签:
原文地址:http://www.cnblogs.com/wangyufu/p/5551966.html