hive 2.3 mysql_Note23:Hive-2.3.6安装配置
安裝包下載安裝
把安裝包上傳到 /opt/software 目錄
解壓
[kevin@hadoop112 software]$ tar -zxvf apache-hive-2.3.6-bin.tar.gz -C /opt/module/
改名
[kevin@hadoop112 module]$ mv apache-hive-2.3.6-bin/ hive-2.3.6
配置
修改conf 目錄下的 hive-env.sh.template 名稱為 hive-env.sh
[kevin@hadoop112 hive-2.3.6]$ cd conf/
[kevin@hadoop112 conf]$ mv hive-env.sh.template hive-env.sh
[kevin@hadoop112 conf]$ vim hive-env.sh
配置 hive-env.sh 文件
# 配置 HADOOP_HOME 路徑
export HADOOP_HOME=/opt/module/hadoop-2.7.2
# 配置 HIVE_CONF_DIR 路徑
export HIVE_CONF_DIR=/opt/module/hive-2.3.6/conf
把Hive的元數(shù)據(jù)配置到MySQL
拷貝 mysql-connector-java-5.1.48-bin.jar 到/opt/module/hive-2.3.6/lib/
[kevin@hadoop112 conf]# cp /opt/software/mysql-libs-CentOS6/mysql-connector-java-5.1.48.jar /opt/module/hive-2.3.6/lib/
配置Metastore 到 MySQL(MySQL增加 metastore 數(shù)據(jù)庫)
在/opt/module/hive-2.3.6/conf 目錄下創(chuàng)建一個(gè) hive-site.xml
[kevin@hadoop112 conf]$ touch hive-site.xml
[kevin@hadoop112 conf]$ vim hive-site.xml
根據(jù)官方文檔配置參數(shù),拷貝數(shù)據(jù)到 hive-site.xml 文件中
javax.jdo.option.ConnectionURL
jdbc:mysql://hadoop112:3306/metastore?createDatabaseIfNotExist=true
JDBC connect string for a JDBC metastore
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
Driver class name for a JDBC metastore
javax.jdo.option.ConnectionUserName
root
username to use against metastore database
javax.jdo.option.ConnectionPassword
000000
password to use against metastore database
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
hive.cli.print.header
true
hive.cli.print.current.db
true
hive.metastore.schema.verification
false
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.
datanucleus.schema.autoCreateAll
true
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.
配置日志存儲(chǔ)位置
[kevin@hadoop112 conf]$ cp hive-log4j.properties.template hive-log4j.properties
[kevin@hadoop112 conf]$ vim hive-log4j.properties
# 修改
hive.log.dir=/opt/module/hive-2.3.6/logs
使用
啟動(dòng)Hadoop集群
[kevin@hadoop112 hive-2.3.6]$ hadoop-cluster.sh start
啟動(dòng)hive
[kevin@hadoop112 hive-2.3.6]$ bin/hive
測試-創(chuàng)建表
hive (default)> create table student(id int, name string);
測試-向表中插入數(shù)據(jù)
hive (default)> insert into student values(1, "zhangsan");
測試-查表
hive (default)> select * from student;
退出
hive (default)> quit;
總結(jié)
以上是生活随笔為你收集整理的hive 2.3 mysql_Note23:Hive-2.3.6安装配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jq处理返回来json_4个小窍门,让你
- 下一篇: linux 管道 top,linux I