》 uname -a
Linux mysql-master 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
》cat /proc/version
Linux version 2.6.32-642.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Tue May 10 17:27:01 UTC 2016
》 cat /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m
一:.安装hive
1.下载
》 wget http://mirrors.shu.edu.cn/apache/hive/hive-2.3.3/apache-hive-2.3.3-bin.tar.gz
2.解压
》tar -zxvf apache-hive-2.3.3-bin.tar.gz
3.修改配置文件
》cd conf/
》cp hive-env.sh.template hive-env.sh
》vim hive-env.sh
(添加如下两行)
export HADOOP_HOME=/opt/soft/hadoop-2.7.5
export HIVE_CONF_DIR=/opt/soft/apache-hive-2.3.3-bin/conf
》cp hive-default.xml.template hive-site.xml
》vim hive-site.xml
(修改一下内容)
(参考:https://blog.csdn.net/cds86333774/article/details/51135954)
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.25:3306/hive?createDatabaseIfNotExist=true</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>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123</value>
<description>password to use against metastore database</description>
</property>
4. 初始化
》pwd
/opt/soft/apache-hive-2.3.3-bin/bin
》 ./bin/schematool -dbType mysql -initSchema
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/opt/soft/apache-hive-2.3.3-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/opt/soft/hadoop-2.7.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL: jdbc:mysql://192.168.1.28:3306/hive?createDatabaseIfNotExist=true
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: oss2
Starting metastore schema initialization to 2.3.0
Initialization script hive-schema-2.3.0.mysql.sql
Initialization script completed
schemaTool completed
二: 安装过程出现的问题
1.Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
(参考:https://blog.csdn.net/cds86333774/article/details/51135954)
2.初始化过程出现问题
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: java.sql.SQLException : Access denied for user 'oss2'@'mysql-master' (using password: YES)
SQL Error code: 1045
Use --verbose for detailed stacktrace.
*** schemaTool failed ***
原因:没有授权
需要在mysql数据库中操作:(用户名:oss2. 密码: Unicom_911,主机名:mysql-master)
GRANT ALL PRIVILEGES ON *.* TO 'oss2'@'mysql-master' IDENTIFIED BY 'Unicom_911' WITH GRANT OPTION;
FLUSH PRIVILEGES
重新初始化,问题解决