日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

hive 2.3 mysql_Note23:Hive-2.3.6安装配置

發布時間:2024/7/23 数据库 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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的元數據配置到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 數據庫)

在/opt/module/hive-2.3.6/conf 目錄下創建一個 hive-site.xml

[kevin@hadoop112 conf]$ touch hive-site.xml

[kevin@hadoop112 conf]$ vim hive-site.xml

根據官方文檔配置參數,拷貝數據到 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.

配置日志存儲位置

[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

使用

啟動Hadoop集群

[kevin@hadoop112 hive-2.3.6]$ hadoop-cluster.sh start

啟動hive

[kevin@hadoop112 hive-2.3.6]$ bin/hive

測試-創建表

hive (default)> create table student(id int, name string);

測試-向表中插入數據

hive (default)> insert into student values(1, "zhangsan");

測試-查表

hive (default)> select * from student;

退出

hive (default)> quit;

總結

以上是生活随笔為你收集整理的hive 2.3 mysql_Note23:Hive-2.3.6安装配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。