环境准备
所有操作开始前,先确定hadoop版本已经装好。具体可以看我的另一篇博客
搭建hadoop3.x
mysql安装
先把安装包放到software文件夹,并解压到mysql-lib中
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
[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
|
先处理一下环境,因为centos自带mariadb,会产生冲突,所以要先卸载
1
2
3
4
5
6
|
[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
|
没什么问题了就可以安装了,一定要按顺序安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
[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
准备中... ################################# [100%]
正在升级/安装...
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
准备中... ################################# [100%]
正在升级/安装...
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
准备中... ################################# [100%]
正在升级/安装...
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
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-client-5.7.28-1.e ################################# [100%]
|
安装到第5个时,如果centos是最小化安装的,那会报这个问题
1
2
3
4
5
6
|
[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
错误:依赖检测失败:
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 需要
|
1
2
|
[root@master mysql-lib] # yum install -y libaio
[root@master mysql-lib] # yum install -y numactl
|
然后再尝试安装就没问题了
1
2
3
4
5
|
[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
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-server-5.7.28-1.e ################################# [100%]
|
清理历史残余文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
[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
1
2
3
4
5
|
#进入这个地址 看看是否有历史残余文件
[root@master mysql-lib] # cd /var/lib/mysql
# 没东西就没问题,有就都删了
[root@master mysql] # ll
总用量 0
|
初始化mysql
1
|
[root@master mysql] # sudo mysqld --initialize --user=mysql
|
看下默认密码
1
2
3
4
5
6
7
8
|
[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/
,复制一下,进入mysql
进入mysql
启动mysql服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
[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.
|
进入mysql
1
|
$ mysql -u root -p
|
提示输入密码,输入刚刚复制的密码
成功进入mysql后,设置我们的mysql密码,这个自己记住哈~
1
2
|
#设置密码为你的密码
mysql> set password = password ( "你的密码" );
|
接下来设置root用户的权限,允许任意ip连接,为后面的hive连接做准备
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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
# 权限高的在最上面(新版本优化的)
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/目录下面
1
|
[root@master software] # tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /home/centos/module/
|
进入module文件夹,把文件名改一下
1
2
3
4
5
6
7
8
9
10
11
|
[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
|
配置环境变量
1
|
[root@master module] # vim /etc/profile.d/my_env.sh
|
1
2
3
|
#HIVE_HOME
export HIVE_HOME= /home/centos/module/hive
export PATH=$PATH:$HIVE_HOME /bin
|
加载环境变量,并验证是否成功
1
2
3
|
[root@master module] # source /etc/profile
[root@master module] # echo $HIVE_HOME
/home/centos/module/hive
|
解决日志Jar包冲突
hadoop和hive之间的log4j版本冲突,要把hive的lib文件夹中的jar包名字改一下,无法启用即可。就直接在文件名后加.bak即可。
1
2
3
4
5
6
7
8
|
[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元数据配置到mysql
将MySQL的JDBC驱动拷贝到Hive的lib目录下
1
|
[root@master lib] # cp /home/centos/software/mysql-connector-java-5.1.37.jar ./
|
看看是否拷贝成功
1
2
|
[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文件,
1
|
[root@master conf] # vim hive-site.xml
|
有三个值需要你改一下
- 腾讯云内网ip
- mysql密码
- 本机hostname
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<? 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://腾讯云内网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默认在HDFS的工作目录 -->
< property >
< name >hive.metastore.warehouse.dir</ name >
< value >/user/hive/warehouse</ value >
</ property >
<!-- Hive元数据存储版本的验证 -->
< property >
< name >hive.metastore.schema.verification</ name >
< value >false</ value >
</ property >
<!-- 指定存储元数据要连接的地址 -->
< property >
< name >hive.metastore.uris</ name >
< value >thrift://腾讯云内网ip:9083</ value >
</ property >
<!-- 指定hiveserver2连接的端口号 -->
< property >
< name >hive.server2.thrift.port</ name >
< value >10000</ value >
</ property >
<!-- 指定hiveserver2连接的host -->
< property >
< name >hive.server2.thrift.bind.host</ name >
< value >你本机的hostname</ value >
</ property >
<!-- 元数据存储授权 -->
< property >
< name >hive.metastore.event.db.notification.api.auth</ name >
< value >false</ value >
</ property >
<!-- hiveserver2的高可用参数,开启此参数可以提高hiveserver2的启动速度 -->
< property >
< name >hive.server2.active.passive.ha.enable</ name >
< value >true</ value >
</ property >
</ configuration >
|
把改好的内容粘进去后,保存退出
启动hive
初始化元数据库
登录mysql,创建hive元数据库
1
2
|
mysql> create database metastore;
Query OK, 1 row affected (0.00 sec)
|
退出,初始化hive元数据库
1
2
|
# 让hive在metastore中创建初始化的表
[atguigu@hadoop102 software]$ schematool -initSchema -dbType mysql -verbos
|
再次进入mysql,检查一下,可以看到已经创建好了(有74张表)
1
2
|
mysql> use metastore;
mysql> show tables;
|
创建一个启动脚本,不然每次写那么长让它后台启动实在太烦了。
1
|
[root@master bin] # vim hs.sh
|
添加如下内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/bin/bash
HIVE_LOG_DIR=$HIVE_HOME /logs
#判断有没有这个目录,没有就创建
if [ ! -d $HIVE_LOG_DIR ]
then
mkdir -p $HIVE_LOG_DIR
fi
#检查进程是否运行正常,参数1为进程名,参数2为进程端口
#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)
#看懂这行即可 ,这行是让服务后台启动的
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服务已启动"
server2pid=$(check_process HiveServer2 10000)
#看懂这行即可 ,这行是让服务后台启动的
cmd= "nohup hive --service hiveserver2 >$HIVE_LOG_DIR/hiveServer2.log 2>&1 &"
[ -z "$server2pid" ] && eval $cmd || echo "HiveServer2服务已启动"
}
#stop
function hive_stop()
{
metapid=$(check_process HiveMetastore 9083)
[ "$metapid" ] && kill $metapid || echo "Metastore服务未启动"
server2pid=$(check_process HiveServer2 10000)
[ "$server2pid" ] && kill $server2pid || echo "HiveServer2服务未启动"
}
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服务运行正常" || echo "Metastore服务运行异常"
check_process HiveServer2 10000 > /dev/null && echo "HiveServer2服务运行正常" || echo "HiveServer2服务运行异常"
;;
*)
echo Invalid Args!
echo 'Usage: ' $( basename $0) ' start|stop|restart|status'
;;
esac
|
保存退出,给脚本加权限
1
|
$ chmod +x hs.sh
|
现在来启动吧(启动前要确认hadoop是已启动,且运行正常的哦)
1
2
3
4
5
6
7
8
9
10
|
[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
|
可以看到启动成功了,我们用脚本来看下状态
1
2
3
|
[root@master bin] # hs.sh status
Metastore服务运行异常
HiveServer2服务运行异常
|
你会惊奇的发现,居然有一个运行异常,这是怎么回事?其实是因为它启动比较慢,不信你过了两分钟再看
1
2
3
|
[root@master bin] # hs.sh status
Metastore服务运行正常
HiveServer2服务运行正常
|
hive jdbc访问
beeline
如果你不是用root来搭建的hadoop,那这里根据自己的设置更改
1
2
3
4
5
6
7
8
|
#必须用root访问,因为jdbc的管理员是root,不然没权限 -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>
|
这样就是成功进入了,退出的话
1
2
|
0: jdbc:hive2: //master :10000> !quit
Closing: 0: jdbc:hive2: //master :10000
|
hive命令行
1
2
3
|
[atguigu@hadoop102 bin]$ hive
#一堆信息
hive>
|
这样就是成功进入了,退出的话是quit;
接下来就可以玩hive啦!
历史记录
他俩的历史记录都在家目录中
1
2
|
$ cd ~
$ ls -a
|
可以到有一个.hivehistory
文件和.beeline
文件夹,历史记录会在你quit这个JDBC后写入。
hive运行日志配置
Hive的log默认存放在当前用户名下下,我们把hive本身的运行日志也放到这个logs里,方便以后查看。
(1)修改$HIVE_HOME/conf/hive-log4j.properties.template
文件名称为hive-log4j.properties
1
2
|
$ mv hive-log4j2.properties.template hive-log4j.properties
$ vim hive-log4j.properties
|
(2)在hive-log4j.properties文件中修改log存放位置
1
|
property.hive.log.dir=/home/centos/module/hive/logs
|
hive启动jvm堆内存设置
新版本的hive启动的时候,默认申请的jvm堆内存大小为256M,jvm堆内存申请的太小,导致后期开启本地模式,执行复杂的sql时经常会报错:java.lang.OutOfMemoryError: Java heap space
,因此最好提前调整一下HADOOP_HEAPSIZE
这个参数。
1
2
|
[atguigu@hadoop102 conf]$ cp hive- env .sh.template hive- env .sh
[atguigu@hadoop102 conf]$ vim hive- env .sh
|
将hive-env.sh其中的参数 export HADOOP_HEAPSIZE=1024
的注释放开
做完以上所有配置,重启hive。
windows端连接hive
推荐dbeaver,连接前记得来到安全组,开放10000端口
具体配置步骤如下
然后
测试连接,等个1分钟左右基本上就可以成功了
后面就在Windows上好好玩hive吧~
到此这篇关于手把手教你在腾讯云上搭建hive3.1.2的方法的文章就介绍到这了,更多相关腾讯云上搭建hive3.1.2内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!
原文链接:https://blog.csdn.net/axy_shelly/article/details/107087174