linux怎么查看本机内存大小
289
2022-08-25
【CentOS】安装 Hive 组件
文章目录
1、解压 Hive 安装包2、配置 Hive 环境变量3、配置 hive-env.sh4、配置 hive-site.xml5、初始化 Hive 元数据
环境准备Hadoop 完全分布式集群系统安装有 MySQLHive 安装包:apache-hive-2.3.9-bin.tar.gzMySQL 连接jar包:mysql-connector-java-5.1.47.jar
1、解压 Hive 安装包
通过 XShell 将安装包上传至虚拟机:
解压安装包并重命名:
返回顶部
2、配置 Hive 环境变量
设置 Hive 环境变量并使其生效:
[root@server ~]# vi /etc/profile# 在文件末尾追加以下配置内容# set hive environmentexport HIVE_HOME=/usr/local/src/hiveexport PATH=$PATH:$HIVE_HOME/bin# 使环境变量配置生效[root@server ~]# source /etc/profile
返回顶部
3、配置 hive-env.sh
拷贝 hive-env.sh.template 文件为 hive-env.sh:
[root@server conf]# cp hive-env.sh.template hive-env.sh
配置内容如下:
# Larger heap size may be required when running queries over large number of files or partitions.# By default hive shell scripts use a heap size of 256 (MB). Larger heap size would also be# appropriate for hive server.# 修改如下:# Set HADOOP_HOME to point to a specific hadoop install directoryHADOOP_HOME=/home/hadoop/hadoop/# Hive Configuration Directory can be controlled by:export HIVE_CONF_DIR=/home/hive/conf/# Folder containing extra libraries required for hive compilation/execution can be controlled by:export HIVE_AUX_JARS_PATH=/home/hive/lib/
注:第一个为Hadoop目录,第二个为Hive配置目录,最后一个为驱动jar包路径
返回顶部
4、配置 hive-site.xml
可以将 /usr/local/src/hive/conf 文件夹下 hive-default.xml.template 文件,更名为 hive-site.xml。也可以自行创建 hive-site.xml 文件(这里我采用自己创建)直接使用 vi 命令打开配置即可:
在 Hive 安装目录中创建临时文件夹 tmp:
返回顶部
5、初始化 Hive 元数据
将 MySQL 数据库驱动(/../download/mysql-connector-java-5.1.46.jar)拷贝到 Hive 安装目录的 lib 下:
[root@server download]# ll总用量 1251432-rw-r--r--. 1 root root 286170958 2月 20 09:34 apache-hive-2.3.9-bin.tar.gz-rw-r--r--. 1 root root 210606807 2月 19 13:18 hadoop-2.7.1.tar.gz-rw-r--r--. 1 root root 185646832 12月 24 17:31 jdk-8u181-linux-x64.tar.gzdrwxr-xr-x. 2 root root 4096 2月 24 20:53 mysql-5.7.22-rw-r--r--. 1 root root 598026240 2月 24 16:13 mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar-rw-r--r--. 1 root root 1004838 2月 26 2018 mysql-connector-java-5.1.46.jar[root@server download]# cp mysql-connector-java-5.1.46.jar /usr/local/src/hive/lib/
重新启动 hadooop 即可:
[root@server sbin]# ./start-all.sh
初始化数据库:
[root@server ~]# schematool -initSchema -dbType mysqlSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/usr/local/src/hive/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/usr/local/src/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See for an explanation.SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]Metastore connection URL: jdbc:mysql://192.168.64.183:3306/hive?createDatabaseIfNotExist=true&characterEncoding=UTF-8Metastore Connection Driver : com.mysql.jdbc.DriverMetastore connection User: rootFri Feb 25 15:01:39 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Starting metastore schema initialization to 2.3.0Initialization script hive-schema-2.3.0.mysql.sqlFri Feb 25 15:01:40 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Initialization script completedFri Feb 25 15:01:41 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
启动hive:
[root@server ~]# hivewhich: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/src/java/bin:/usr/local/src/hadoop/bin:/usr/local/src/hadoop/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/src/java/bin:/root/bin:/usr/local/src/java/bin:/usr/local/src/hadoop/bin:/usr/local/src/hadoop/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/src/java/bin:/usr/local/src/hadoop/bin:/usr/local/src/hadoop/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/src/java/bin:/root/bin:/usr/local/src/java/bin:/usr/local/src/hive/bin)SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/usr/local/src/hive/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/usr/local/src/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See for an explanation.SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]Logging initialized using configuration in jar:file:/usr/local/src/hive/lib/hive-common-2.3.9.jar!/hive-log4j2.properties Async: trueHive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.hive>
Hive 启动成功的同时,在mysql数据库中会建立一个hive数据库:
[root@server ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 13Server version: 5.7.22 MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || hive || mysql || performance_schema || sys |+--------------------+5 rows in set (0.07 sec)
到此 hive 安装完成!
返回顶部
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~