環(huán)境準(zhǔn)備
所有操作開始前,先確定hadoop版本已經(jīng)裝好。具體可以看我的另一篇博客
搭建hadoop3.x
mysql安裝
先把安裝包放到software文件夾,并解壓到mysql-lib中
[root@master software]# ll
總用量 1422372
-rw-r--r-- 1 root root 312850286 7月 2 15:00 apache-hive-3.1.2-bin.tar.gz
-rw-r--r-- 1 root root 338075860 7月 2 09:39 hadoop-3.1.3.tar.gz
-rw-r--r-- 1 root root 195013152 7月 2 09:36 jdk-8u212-linux-x64.tar.gz
-rw-r--r-- 1 root root 609556480 7月 2 15:08 mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 root root 985600 7月 2 14:44 mysql-connector-java-5.1.37.jar
[root@master software]# mkdir mysql-lib
[root@master software]# tar -xf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar -C ./mysql-lib/
[root@master software]# cd mysql-lib/
[root@master mysql-lib]# ll
總用量 595272
-rw-r--r-- 1 7155 31415 45109364 9月 30 2019 mysql-community-client-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 318768 9月 30 2019 mysql-community-common-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 7037096 9月 30 2019 mysql-community-devel-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 49329100 9月 30 2019 mysql-community-embedded-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 23354908 9月 30 2019 mysql-community-embedded-compat-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 136837816 9月 30 2019 mysql-community-embedded-devel-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 4374364 9月 30 2019 mysql-community-libs-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 1353312 9月 30 2019 mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 208694824 9月 30 2019 mysql-community-server-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 133129992 9月 30 2019 mysql-community-test-5.7.28-1.el7.x86_64.rpm
先處理一下環(huán)境,因?yàn)閏entos自帶mariadb,會(huì)產(chǎn)生沖突,所以要先卸載
[root@master mysql-lib]# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@master mysql-lib]# sudo rpm -e --nodeps mariadb-libs
# 查看一下是不是卸載干凈了
[root@master mysql-lib]# rpm -qa|grep mariadb
[root@master mysql-lib]# rpm -qa|grep mysql
沒什么問題了就可以安裝了,一定要按順序安裝
[root@master mysql-lib]# ll
總用量 595284
-rw-r--r-- 1 7155 31415 45109364 9月 30 2019 mysql-community-client-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 318768 9月 30 2019 mysql-community-common-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 7037096 9月 30 2019 mysql-community-devel-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 49329100 9月 30 2019 mysql-community-embedded-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 23354908 9月 30 2019 mysql-community-embedded-compat-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 136837816 9月 30 2019 mysql-community-embedded-devel-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 4374364 9月 30 2019 mysql-community-libs-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 1353312 9月 30 2019 mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 208694824 9月 30 2019 mysql-community-server-5.7.28-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 133129992 9月 30 2019 mysql-community-test-5.7.28-1.el7.x86_64.rpm
[root@master mysql-lib]# sudo rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.28-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準(zhǔn)備中... ################################# [100%]
正在升級(jí)/安裝...
1:mysql-community-common-5.7.28-1.e################################# [100%]
[root@master mysql-lib]# sudo rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
警告:mysql-community-libs-5.7.28-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準(zhǔn)備中... ################################# [100%]
正在升級(jí)/安裝...
1:mysql-community-libs-5.7.28-1.el7################################# [100%]
[root@master mysql-lib]# sudo rpm -ivh mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
警告:mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準(zhǔn)備中... ################################# [100%]
正在升級(jí)/安裝...
1:mysql-community-libs-compat-5.7.2################################# [100%]
[root@master mysql-lib]# sudo rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
警告:mysql-community-client-5.7.28-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準(zhǔn)備中... ################################# [100%]
正在升級(jí)/安裝...
1:mysql-community-client-5.7.28-1.e################################# [100%]
安裝到第5個(gè)時(shí),如果centos是最小化安裝的,那會(huì)報(bào)這個(gè)問題
[root@master mysql-lib]# sudo rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.28-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
錯(cuò)誤:依賴檢測失?。?
libnuma.so.1()(64bit) 被 mysql-community-server-5.7.28-1.el7.x86_64 需要
libnuma.so.1(libnuma_1.1)(64bit) 被 mysql-community-server-5.7.28-1.el7.x86_64 需要
libnuma.so.1(libnuma_1.2)(64bit) 被 mysql-community-server-5.7.28-1.el7.x86_64 需要
[root@master mysql-lib]# yum install -y libaio
[root@master mysql-lib]# yum install -y numactl
然后再嘗試安裝就沒問題了
[root@master mysql-lib]# sudo rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.28-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準(zhǔn)備中... ################################# [100%]
正在升級(jí)/安裝...
1:mysql-community-server-5.7.28-1.e################################# [100%]
清理歷史殘余文件
[root@master mysql-lib]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
看到了mysql目錄是/var/lib/mysql
#進(jìn)入這個(gè)地址 看看是否有歷史殘余文件
[root@master mysql-lib]# cd /var/lib/mysql
# 沒東西就沒問題,有就都刪了
[root@master mysql]# ll
總用量 0
初始化mysql
[root@master mysql]# sudo mysqld --initialize --user=mysql
看下默認(rèn)密碼
[root@master mysql]# cat /var/log/mysqld.log
2020-07-02T07:29:10.095244Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-07-02T07:29:11.331738Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-07-02T07:29:11.498492Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-07-02T07:29:11.590436Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: b94654a6-bc35-11ea-a160-525400f3e388.
2020-07-02T07:29:11.600554Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-07-02T07:29:13.093996Z 0 [Warning] CA certificate ca.pem is self signed.
2020-07-02T07:29:13.522160Z 1 [Note] A temporary password is generated for root@localhost: p;oK<M)<_8p/
密碼是p;oK<M)<_8p/
,復(fù)制一下,進(jìn)入mysql
進(jìn)入mysql
啟動(dòng)mysql服務(wù)
[root@master mysql]# systemctl start mysqld
[root@master mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 四 2020-07-02 15:31:00 CST; 10s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 5617 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 5497 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 5624 (mysqld)
Tasks: 27
Memory: 205.4M
CGroup: /system.slice/mysqld.service
└─5624 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.p...
7月 02 15:30:55 master systemd[1]: Starting MySQL Server...
7月 02 15:31:00 master systemd[1]: Started MySQL Server.
進(jìn)入mysql
提示輸入密碼,輸入剛剛復(fù)制的密碼
成功進(jìn)入mysql后,設(shè)置我們的mysql密碼,這個(gè)自己記住哈~
#設(shè)置密碼為你的密碼
mysql> set password = password("你的密碼");
接下來設(shè)置root用戶的權(quán)限,允許任意ip連接,為后面的hive連接做準(zhǔn)備
mysql> use mysql;
mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
3 rows in set (0.00 sec)
mysql> update mysql.user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
# 權(quán)限高的在最上面(新版本優(yōu)化的)
mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | root |
| localhost | mysql.session |
| localhost | mysql.sys |
+-----------+---------------+
3 rows in set (0.00 sec)
--這步一定要做,是刷新配置的,不然密碼無法生效
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
然后再嘗試用更改后的密碼登錄一下,成功了就是配置好了。
安裝Hive
到/home/centos/software目錄下,解壓apache-hive-3.1.2-bin.tar.gz到/home/centos/module/目錄下面
[root@master software]# tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /home/centos/module/
進(jìn)入module文件夾,把文件名改一下
[root@master module]# ll
總用量 12
drwxr-xr-x 9 root root 4096 7月 2 15:40 apache-hive-3.1.2-bin
drwxr-xr-x 11 centos centos 4096 7月 2 11:51 hadoop-3.1.3
drwxr-xr-x 7 10 143 4096 4月 2 2019 jdk1.8.0_212
[root@master module]# mv apache-hive-3.1.2-bin/ hive
[root@master module]# ll
總用量 12
drwxr-xr-x 11 centos centos 4096 7月 2 11:51 hadoop-3.1.3
drwxr-xr-x 9 root root 4096 7月 2 15:40 hive
drwxr-xr-x 7 10 143 4096 4月 2 2019 jdk1.8.0_212
配置環(huán)境變量
[root@master module]# vim /etc/profile.d/my_env.sh
#HIVE_HOME
export HIVE_HOME=/home/centos/module/hive
export PATH=$PATH:$HIVE_HOME/bin
加載環(huán)境變量,并驗(yàn)證是否成功
[root@master module]# source /etc/profile
[root@master module]# echo $HIVE_HOME
/home/centos/module/hive
解決日志Jar包沖突
hadoop和hive之間的log4j版本沖突,要把hive的lib文件夾中的jar包名字改一下,無法啟用即可。就直接在文件名后加.bak即可。
[atguigu@hadoop102 lib]$ mv log4j-slf4j-impl-2.10.0.jar log4j-slf4j-impl-2.10.0.jar.bak
[atguigu@hadoop102 lib]$ ll | grep log4j
-rw-rw-r--. 1 atguigu atguigu 63835 4月 15 00:34 log4j-1.2-api-2.10.0.jar
-rw-rw-r--. 1 atguigu atguigu 255485 4月 15 00:24 log4j-api-2.10.0.jar
-rw-rw-r--. 1 atguigu atguigu 1597622 4月 15 00:24 log4j-core-2.10.0.jar
-rw-rw-r--. 1 atguigu atguigu 24173 4月 15 00:24 log4j-slf4j-impl-2.10.0.jar.bak
-rw-rw-r--. 1 atguigu atguigu 32060 4月 15 00:34 log4j-web-2.10.0.jar
hive元數(shù)據(jù)配置到mysql
將MySQL的JDBC驅(qū)動(dòng)拷貝到Hive的lib目錄下
[root@master lib]# cp /home/centos/software/mysql-connector-java-5.1.37.jar ./
看看是否拷貝成功
[root@master lib]# ll | grep mysql-con
-rw-r--r-- 1 root root 985600 7月 2 15:47 mysql-connector-java-5.1.37.jar
配置metastore到mysql
在$HIVE_HOME/conf目錄下新建hive-site.xml文件,
[root@master conf]# vim hive-site.xml
有三個(gè)值需要你改一下
- 騰訊云內(nèi)網(wǎng)ip
- mysql密碼
- 本機(jī)hostname
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl" rel="external nofollow" ?>
<configuration>
<!-- jdbc連接的URL -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://騰訊云內(nèi)網(wǎng)ip:3306/metastore?useSSL=false</value>
</property>
<!-- jdbc連接的Driver-->
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<!-- jdbc連接的username-->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<!-- jdbc連接的password -->
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>你的mysql密碼</value>
</property>
<!-- Hive默認(rèn)在HDFS的工作目錄 -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<!-- Hive元數(shù)據(jù)存儲(chǔ)版本的驗(yàn)證 -->
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
<!-- 指定存儲(chǔ)元數(shù)據(jù)要連接的地址 -->
<property>
<name>hive.metastore.uris</name>
<value>thrift://騰訊云內(nèi)網(wǎng)ip:9083</value>
</property>
<!-- 指定hiveserver2連接的端口號(hào) -->
<property>
<name>hive.server2.thrift.port</name>
<value>10000</value>
</property>
<!-- 指定hiveserver2連接的host -->
<property>
<name>hive.server2.thrift.bind.host</name>
<value>你本機(jī)的hostname</value>
</property>
<!-- 元數(shù)據(jù)存儲(chǔ)授權(quán) -->
<property>
<name>hive.metastore.event.db.notification.api.auth</name>
<value>false</value>
</property>
<!-- hiveserver2的高可用參數(shù),開啟此參數(shù)可以提高h(yuǎn)iveserver2的啟動(dòng)速度 -->
<property>
<name>hive.server2.active.passive.ha.enable</name>
<value>true</value>
</property>
</configuration>
把改好的內(nèi)容粘進(jìn)去后,保存退出
啟動(dòng)hive
初始化元數(shù)據(jù)庫
登錄mysql,創(chuàng)建hive元數(shù)據(jù)庫
mysql> create database metastore;
Query OK, 1 row affected (0.00 sec)
退出,初始化hive元數(shù)據(jù)庫
# 讓hive在metastore中創(chuàng)建初始化的表
[atguigu@hadoop102 software]$ schematool -initSchema -dbType mysql -verbos
再次進(jìn)入mysql,檢查一下,可以看到已經(jīng)創(chuàng)建好了(有74張表)
mysql> use metastore;
mysql> show tables;
創(chuàng)建一個(gè)啟動(dòng)腳本,不然每次寫那么長讓它后臺(tái)啟動(dòng)實(shí)在太煩了。
[root@master bin]# vim hs.sh
添加如下內(nèi)容
#!/bin/bash
HIVE_LOG_DIR=$HIVE_HOME/logs
#判斷有沒有這個(gè)目錄,沒有就創(chuàng)建
if [ ! -d $HIVE_LOG_DIR ]
then
mkdir -p $HIVE_LOG_DIR
fi
#檢查進(jìn)程是否運(yùn)行正常,參數(shù)1為進(jìn)程名,參數(shù)2為進(jìn)程端口
#status
function check_process()
{
#/dev/null 黑洞 不要的流都放到這里銷毀
pid=$(ps -ef 2>/dev/null | grep -v grep | grep -i $1 | awk '{print $2}')
ppid=$(netstat -nltp 2>/dev/null | grep $2 | awk '{print $7}' | cut -d '/' -f 1)
echo $pid
[[ "$pid" =~ "$ppid" ]] && [ "$ppid" ] && return 0 || return 1
}
#start
function hive_start()
{
metapid=$(check_process HiveMetastore 9083)
#看懂這行即可 ,這行是讓服務(wù)后臺(tái)啟動(dòng)的
cmd="nohup hive --service metastore >$HIVE_LOG_DIR/metastore.log 2>&1 &"
cmd=$cmd" sleep 4; hdfs dfsadmin -safemode wait >/dev/null 2>&1"
[ -z "$metapid" ] && eval $cmd || echo "Metastroe服務(wù)已啟動(dòng)"
server2pid=$(check_process HiveServer2 10000)
#看懂這行即可 ,這行是讓服務(wù)后臺(tái)啟動(dòng)的
cmd="nohup hive --service hiveserver2 >$HIVE_LOG_DIR/hiveServer2.log 2>&1 &"
[ -z "$server2pid" ] && eval $cmd || echo "HiveServer2服務(wù)已啟動(dòng)"
}
#stop
function hive_stop()
{
metapid=$(check_process HiveMetastore 9083)
[ "$metapid" ] && kill $metapid || echo "Metastore服務(wù)未啟動(dòng)"
server2pid=$(check_process HiveServer2 10000)
[ "$server2pid" ] && kill $server2pid || echo "HiveServer2服務(wù)未啟動(dòng)"
}
case $1 in
"start")
hive_start
;;
"stop")
hive_stop
;;
"restart")
hive_stop
sleep 2
hive_start
;;
"status")
check_process HiveMetastore 9083 >/dev/null && echo "Metastore服務(wù)運(yùn)行正常" || echo "Metastore服務(wù)運(yùn)行異常"
check_process HiveServer2 10000 >/dev/null && echo "HiveServer2服務(wù)運(yùn)行正常" || echo "HiveServer2服務(wù)運(yùn)行異常"
;;
*)
echo Invalid Args!
echo 'Usage: '$(basename $0)' start|stop|restart|status'
;;
esac
保存退出,給腳本加權(quán)限
現(xiàn)在來啟動(dòng)吧(啟動(dòng)前要確認(rèn)hadoop是已啟動(dòng),且運(yùn)行正常的哦)
[root@master bin]# hs.sh start
[root@master bin]# jps
32177 SecondaryNameNode
514 NodeManager
20788 Jps
31396 NameNode
32652 ResourceManager
20253 RunJar
31757 DataNode
991 JobHistoryServer
可以看到啟動(dòng)成功了,我們用腳本來看下狀態(tài)
[root@master bin]# hs.sh status
Metastore服務(wù)運(yùn)行異常
HiveServer2服務(wù)運(yùn)行異常
你會(huì)驚奇的發(fā)現(xiàn),居然有一個(gè)運(yùn)行異常,這是怎么回事?其實(shí)是因?yàn)樗鼏?dòng)比較慢,不信你過了兩分鐘再看
[root@master bin]# hs.sh status
Metastore服務(wù)運(yùn)行正常
HiveServer2服務(wù)運(yùn)行正常
hive jdbc訪問
beeline
如果你不是用root來搭建的hadoop,那這里根據(jù)自己的設(shè)置更改
#必須用root訪問,因?yàn)閖dbc的管理員是root,不然沒權(quán)限 -n后面是要登錄的用戶
[atguigu@hadoop102 bin]$ beeline -u jdbc:hive2://master:10000 -n root
Connecting to jdbc:hive2://master:10000
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.2 by Apache Hive
0: jdbc:hive2://master:10000>
這樣就是成功進(jìn)入了,退出的話
0: jdbc:hive2://master:10000> !quit
Closing: 0: jdbc:hive2://master:10000
hive命令行
[atguigu@hadoop102 bin]$ hive
#一堆信息
hive>
這樣就是成功進(jìn)入了,退出的話是quit;
接下來就可以玩hive啦!
歷史記錄
他倆的歷史記錄都在家目錄中
可以到有一個(gè).hivehistory
文件和.beeline
文件夾,歷史記錄會(huì)在你quit這個(gè)JDBC后寫入。
hive運(yùn)行日志配置
Hive的log默認(rèn)存放在當(dāng)前用戶名下下,我們把hive本身的運(yùn)行日志也放到這個(gè)logs里,方便以后查看。
(1)修改$HIVE_HOME/conf/hive-log4j.properties.template
文件名稱為hive-log4j.properties
$ mv hive-log4j2.properties.template hive-log4j.properties
$ vim hive-log4j.properties
(2)在hive-log4j.properties文件中修改log存放位置
property.hive.log.dir=/home/centos/module/hive/logs
hive啟動(dòng)jvm堆內(nèi)存設(shè)置
新版本的hive啟動(dòng)的時(shí)候,默認(rèn)申請(qǐng)的jvm堆內(nèi)存大小為256M,jvm堆內(nèi)存申請(qǐng)的太小,導(dǎo)致后期開啟本地模式,執(zhí)行復(fù)雜的sql時(shí)經(jīng)常會(huì)報(bào)錯(cuò):java.lang.OutOfMemoryError: Java heap space
,因此最好提前調(diào)整一下HADOOP_HEAPSIZE
這個(gè)參數(shù)。
[atguigu@hadoop102 conf]$ cp hive-env.sh.template hive-env.sh
[atguigu@hadoop102 conf]$ vim hive-env.sh
將hive-env.sh其中的參數(shù) export HADOOP_HEAPSIZE=1024
的注釋放開
做完以上所有配置,重啟hive。
windows端連接hive
推薦dbeaver,連接前記得來到安全組,開放10000端口
具體配置步驟如下
然后
測試連接,等個(gè)1分鐘左右基本上就可以成功了
后面就在Windows上好好玩hive吧~
到此這篇關(guān)于手把手教你在騰訊云上搭建hive3.1.2的方法的文章就介紹到這了,更多相關(guān)騰訊云上搭建hive3.1.2內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!