下载
-
wget http://mirrors.hust.edu.cn/apache/hive/hive-2.3.2/apache-hive-2.3.2-bin.tar.gz
-
解压到指定目录 tar -zxvf ..
配置HIVE_HOME
vim /etc/profile
export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin
修改HIVE/CONF的文件配置
cp hive-env.sh.template hive-env.sh
cp hive-default.xml.template hive-site.xml
vim hive-env.sh
HADOOP_HOME=$HADOOP_HOME
vim hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true;u??seSSL=false</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>
注释:
javax.jdo.option.ConnectionURL参数指定的是Hive连接数据库的连接字符串;
javax.jdo.option.ConnectionDriverName参数指定的是驱动的类入口名称;
javax.jdo.option.ConnectionUserName参数指定了数据库的用户名;
javax.jdo.option.ConnectionPassword参数指定了数据库的密码。
- 配置mysql需要,创建元数据保存在Mysql中
下载mysql-connector-java-5.1.46.tar.gz包放到Hive的lib目录下
可以在指定search.maven(maven仓库)中去下载
启动hive
cd bin
./hive
-
以上执行会报错:
Exception in thread "main" Java.lang.IllegalArgumentException:java.net.URISyntaxException: Relative path in absolute URI
-
解决方法:在hive下创建一个目录temdir,并配置到hive-site.xml中
mkdir tmpdir
vim hive-site.xml
查找:/system:java.io.tmpdir,并替换为tmpdir目录
-
再次执行./hive
问题
hive Call From node1/ip to node1:9000 failed on connection exception: java.net.ConnectException: Connection refused
- 以上问题一般就是hadoop没有启动