之前搭建的都是1.x版本,这次搭建的是hive3.1.2版本的。。还是有一点细节不一样的
Hive现在解析引擎可以选择spark,我是用spark做解析引擎的,存储还是用的HDFS
我是在docker里面搭建的集群,所以都是基于docker操作的
Hive官网下载
微云下载 | 在 tar 目录下
我使用的相关软件版本
tar xivf apache-hive-3.1.2-bin -C /opt/hive/
mdkir /opt/hive/iotmp
Hive启动时获取的 ${system:java.io.tmpdir}
${system:user.name}
这两个变量获取绝对值有误,需要手动指定真实路径,替换其默认路径
将hive-site.xml
配置里面所有相关变量全部替换掉
:%s/${system:java.io.tmpdir}/\/opt\/hive\/iotmp/g
:%s/${system:user.name}/huan/g
create database hive;
微云下载 | jar包目录下
mv /opt/hive/apache-hive-3.1.2-bin/lib/jline-2.12.jar /opt/hadoop/hadoop-2.7.7/share/hadoop/yarn/
我是用的是远程分布式架构,一个master提供服务,3个client远程连接master
hvie-site.xml
配置文件cp hive-default.xml.template hive-site.xml
<property>
<name>hive.metastore.db.typename>
<value>mysqlvalue>
<description>
Expects one of [derby, oracle, mysql, mssql, postgres].
Type of database used by the metastore. Information schema & JDBCStorageHandler depend on it.
description>
property>
<property>
<name>javax.jdo.option.ConnectionDriverNamename>
<value>com.mysql.jdbc.Drivervalue>
<description>Driver class name for a JDBC metastoredescription>
property>
<property>
<name>javax.jdo.option.ConnectionURLname>
<value>jdbc:mysql://192.168.11.46:13306/hive?createDatabaseIfNotExist=truevalue>
<description>
JDBC connect string for a JDBC metastore.
To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
description>
property>
<property>
<name>javax.jdo.option.ConnectionUserNamename>
<value>rootvalue>
<description>Username to use against metastore databasedescription>
property>
<property>
<name>javax.jdo.option.ConnectionPasswordname>
<value>rootvalue>
<description>password to use against metastore databasedescription>
<property>
<property>
<name>hive.execution.enginename>
<value>sparkvalue>
<description>
Expects one of [mr, tez, spark].
Chooses execution engine. Options are: mr (Map reduce, default), tez, spark. While MR
remains the default engine for historical reasons, it is itself a historical engine
and is deprecated in Hive 2 line. It may be removed without further warning.
description>
property>
<property>
<name>datanucleus.schema.autoCreateAllname>
<value>truevalue>
<description>Auto creates necessary schema on a startup if one doesn't exist. Set this to false, after creating it once.To enable auto create also set hive.metastore.schema.verification=false. Auto creation is not recommended for production use cases, run schematool command instead.
description>
property>
<property>
<name>hive.metastore.schema.verificationname>
<value>falsevalue>
<description>
Enforce metastore schema version consistency.
True: Verify that version information stored in is compatible with one from Hive jars. Also disable automatic
schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures
proper metastore schema migration. (Default)
False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
description>
property>
<property>
<name>hive.conf.validationname>
<value>falsevalue>
<description>Enables type checking for registered Hive configurationsdescription>
property>
,这个解析会报错<property>
<name>hive.txn.xlock.iowname>
<value>truevalue>
<description>
Ensures commands with OVERWRITE (such as INSERT OVERWRITE) acquire Exclusive locks fortransactional tables. This ensures that inserts (w/o overwrite) running concurrently
are not hidden by the INSERT OVERWRITE.
description>
property>
scp hive-site.xml 目的结点IP或目的结点主机名:目的主机保存目录
<property>
<name>hive.metastore.urisname>
<value>thrift://cluster-master:9083value>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.description>
property>
:%s/${system:java.io.tmpdir}/\/opt\/hive\/iotmp/g
:%s/${system:user.name}/huan/g
启动时会自动初始化元数据,可以查看数据库是否有表生成
./hive --service metastore &
hive