Hive 组件安装配置
下载和解压安装文件 基础环境和安装准备
- Hive组件的部署规划和软件包路径如下:
(1)当前环境中已安装 Hadoop全分布系统
(2)本地安装 MySQL数据库(账号 root,密码 Password123$),软件包在/opt/software/mysql-5.7.18路径下
(3)MySQL端口号(3306)
(4)MySQL的 JDBC驱动包/opt/software/mysql-connector-java-5.1.47.jar,在此基础上更新 Hive元数据存储
(5)Hive软件包/opt/software/apache-hive-2.0.0-bin.tar.gz - 解压安装文件
(1)使用 root用户,将 Hive安装包
/opt/software/apache-hive-2.0.0-bin.tar.gz路解压到/usr/local/src路径下
[root@master ~]# tar -zxvf /opt/software/apache-hive-2.0.0-bin.tar.gz -C /usr/local/src
(2)将解压后的 apache-hive-2.0.0-bin文件夹更名为 hive
[root@master ~]# mv /usr/local/src/apache-hive-2.0.0-bin usr/local/src/hive
(3)修改 hive目录归属用户和用户组为 hadoop
[root@master ~]# chown -R hadoop:hadoop /usr/local/src/hive
设置 Hive 环境
- 卸载 MariaDB 数据库
Hive元数据存储在 MySQL数据库中,因此在部署 Hive组件前需要首先在 Linux系统下安装 MySQL数据库,并进行 MySQL字符集、安全初始化、远程访问权限等相关配置。
需要使用 root用户登录,执行如下操作步骤:
(1)关闭 Linux系统防火墙,并将防火墙设定为系统开机并不自动启动。
关闭防火墙服务
[root@master ~]# systemctl stop firewalld
(2)设置防火墙服务开机不启动
[root@master ~]# systemctl disable firewalld
(3)卸载 Linux系统自带的 MariaDB。
首先查看 Linux系统中 MariaDB的安装情况
查询已安装的 mariadb软件包
[root@ master ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.52-2.el7.x86_64
以上结果显示 Linux系统中已经按照了 mariadb-libs-5.5.52-2.el7.x86_64软件包
需要将其卸载。
(4)卸载 MariaDB软件包
[root@master ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
安装 MySQL 数据库
按如下顺序依次按照 MySQL数据库的 mysql common、mysql libs、mysql client软件包
(1)MySQL软件包路径
yum -y install unzip
unzip mysql-5.7.18/
[root@master ~]# cd /opt/software/mysql-5.7.18/
[root@master ~]# rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
[root@master ~]# rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
[root@master ~]# rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
(2)安装 mysql server软件包
[root@master ~]# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
(3)修改 MySQL数据库配置,在/etc/my.cnf文件中添加如表 6-1所示的 MySQL数据库配置项
将以下配置信息添加到/etc/my.cnf文件 symbolic-links=0配置信息的下方
default-storage-engine=innodb
innodb_file_per_table
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server=utf8
(4)启动 MySQL数据库
[root@master ~]# systemctl start mysqld
(5)查询 MySQL数据库状态。mysqld进程状态为 active (running),则表示 MySQL数据库正常运行
如果 mysqld 进程状态为 failed,则表示 MySQL 数据库启动异常。此时需要排查/etc/my.cnf文件
[root@master ~]# systemctl status mysqld
(6)查询 MySQL数据库默认密码
MySQL 数据库安装后的默认密码保存在/var/log/mysqld.log 文件中,在该文件中以password关键字搜索默认密码
[root@master ~]# cat /var/log/mysqld.log | grep password
2020-05-07T02:34:03.336724Z 1 [Note] A temporary password is generated for root@localhost: MPg5lhk4?>Ui
# 默 认 密 码 为:MPg5lhk4?>Ui
MySQL数据库是安装后随机生成的,所以每次安装后生成的默认密码不相同
(7)MySQL数据库初始化
执行mysql_secure_installation命令初始化 MySQL数据库,初始化过程中需要设定
数据库 root 用户登录密码,密码需符合安全规则,包括大小写字符、数字和特殊符号,
可设定密码为 Password123$
在进行 MySQL数据库初始化过程中会出现以下交互确认信息:
1)Change the password for root ? ((Press y|Y for Yes, any other key for No)
表示是否更改 root用户密码
2)Do you wish to continue with the password provided?(Press y|Y for Yes,any other key for No)
表示是否使用设定的密码继续,在键盘输入 y和回车。
3)Remove anonymous users? (Press y|Y for Yes, any other key for No)
表示是否删除匿名用户
4)Disallow root login remotely? (Press y|Y for Yes, any other key for No)
表示是否拒绝 root 用户远程登录,在键盘输入 n 和回车
5)Remove test database and access to it? (Press y|Y for Yes, any other key for No)
表示是否删除测试数据库
6)Reload privilege tables now? (Press y|Y for Yes, any other key for No)
表示是否重新加载授权表
#mysql_secure_installation命令执行过程如下:
[root@master ~]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: # 输入/var/log/mysqld.log 文件中查询到的默认 root用户登录密码
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other
key for No) : y
New password: #输入新密码 Password123$
Re-enter new password: #再次输入新密码 Password123$
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y #输入 y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y #输入 y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n #输入 n
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y #输入 y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y #输入
Success.
All done!
(8)添加 root用户从本地和远程访问 MySQL数据库表单的授权
[root@master ~]# mysql -uroot -p
Enter password: #输入新设定的密码 Password123$
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All
rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current
input statement.
#进入之后
mysql> grant all privileges on *.* to root@'localhost'
identified by 'Password123$'; # 添加 root用户本地访问授权
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> grant all privileges on *.* to root@'%' identified by 'Password123$'; # 添加 root用户远程访问授权
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges; # 刷新授权 Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from mysql.user where user='root'; # 查询 root用户授权情况
+------+-----------+
| user | host |
+------+-----------+
| root | % |
| root | localhost |
+------+-----------+
2 rows in set (0.00 sec)
mysql> exit; # 退出 MySQL数据库
Bye
配置 Hive 组件
(1)设置 Hive环境变量并使其生效。
在文件末尾追加以下配置内容
[root@master ~]# vi /etc/profile
# set hive environment
export HIVE_HOME=/usr/local/src/hive
export PATH=$PATH:$HIVE_HOME/bin
使环境变量配置生效
[root@master ~]# source /etc/profile
(2)修改 Hive组件配置文件
切换到 hadoop用户执行以下对 Hive组件的配置操作
将/usr/local/src/hive/conf 文件夹下 hive-default.xml.template 文件,更名为hive-site.xml
[root@master ~]# su - hadoop
[hadoop@master ~]$ cp /usr/local/src/hive/conf/hive-default.xml.template /usr/local/src/hive/conf/hive-site.xml
(3)通过 vi 编辑器修改 hive-site.xml 文件实现 Hive 连接 MySQL 数据库,并设定Hive临时文件存储路径
[hadoop@master ~]$ vi /usr/local/src/hive/conf/hive-site.xml
#设置 MySQL数据库连接。
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=true&useSSL=false</value>
<description>JDBC connect string for a JDBC metastore</description>
#配置 MySQL数据库 root的密码。
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>Password123$</value>
<description>password to use against s database</description>
</property>
#验证元数据存储版本一致性。若默认 false,则不用修改。
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
<description>
Enforce metastore schema version consistency.
True: Verify that version information stored in is compatible with one from
Hive jars. Also disable automatic
False: Warn if the version information stored in metastore doesn't match
with one from in Hive jars.
</description>
</property>
#配置数据库驱动
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
#配置数据库用户名 javax.jdo.option.ConnectionUserName为 root。
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>Username to use against metastore database</description>
</property>
#将 以 下 位 置 的 ${system:java.io.tmpdir}/${system:user.name} 替 换 为“/usr/local/src/hive/tmp”目录及其子目录
#需要替换以下 4处配置内容:
<name>hive.querylog.location</name>
<value>/usr/local/src/hive/tmp</value>
<description>Location of Hive run time structured log
file</description>
<name>hive.exec.local.scratchdir</name>
<value>/usr/local/src/hive/tmp</value>
<name>hive.downloaded.resources.dir</name>
<value>/usr/local/src/hive/tmp/resources</value>
<name>hive.server2.logging.operation.log.location</name>
<value>/usr/local/src/hive/tmp/operation_logs</value>
(4)在 Hive安装目录中创建临时文件夹 tmp
[hadoop@master ~]$ mkdir /usr/local/src/hive/tmp
至此,Hive组件安装和配置完成!
初始化 hive 元数据
#将 MySQL数据库驱动(/opt/software/mysql-connector-java-5.1.46.jar)拷贝到Hive安装目录的 lib下
[hadoop@master ~]$ cp /opt/software/mysql-connector-java-5.1.46.jar /usr/local/src/hive/lib/
#重新启动 hadooop即可
[hadoop@master lib]$ stop-all.sh
[hadoop@master lib]$ start-all.sh #初始化数据库
[hadoop@master ~]$ schematool -initSchema -dbType mysql
看到 schemaTool completed 即为成功!
#启动 hive
[hadoop@master ~]$ hive
进入hive即为成功!
Hive 组件安装配置的更多相关文章
- Hive的安装配置
Hive的安装配置 Hive的安装配置 安装前准备 下载Hive版本1.2.1: 1.[root@iZ28gvqe4biZ ~]# wget http://mirror.bit.edu.cn/apac ...
- ZooKeeper 组件安装配置
ZooKeeper 组件安装配置 下载和安装 ZooKeeper ZooKeeper最新的版本可以通过官网 http://hadoop.apache.org/zookeeper/ 来获取,安装 Zoo ...
- 【转】hive简介安装 配置常见问题和例子
原文来自: http://blog.csdn.net/zhumin726/article/details/8027802 1 HIVE概述 Hive是基于Hadoop的一个数据仓库工具,可以将结构化 ...
- [Hive_2] Hive 的安装&配置
0. 说明 在安装好 Hadoop 集群和 ZooKeeper 分布式的基础上装好 MySQL,再进行 Hive 安装配置 1. 安装 1.1 将 Hive 安装包通过 Xftp 发送到 /home/ ...
- Flume 组件安装配置
下载和解压 Flume 实验环境可能需要回至第四,五,六章(hadoop和hive),否则后面传输数据可能报错(猜测)! 可 以 从 官 网 下 载 Flume 组 件 安 装 包 , 下 载 地 址 ...
- Hive 2、Hive 的安装配置(本地MySql模式)
一.前提条件 安装了Zookeeper.Hadoop HDFS HA 安装方法: http://www.cnblogs.com/raphael5200/p/5154325.html 二.安装Mysq ...
- Hive 3、Hive 的安装配置(本地derby模式)
这种方式是最简单的存储方式,只需要在hive-site.xml做如下配置便可; $ vim hive-site.xml <configuration> <property> ...
- Hive 4、Hive 的安装配置(远端MyMql模式)
1.remote一体 这种存储方式需要在远端服务器运行一个mysql服务器,并且需要在Hive服务器启动meta服务.这里用mysql的测试服务器,ip位192.168.1.214,新建hive_re ...
- Hive的安装配置 & 基础指令
Hive 基础命令
随机推荐
- python基础知识-day9(库学习)
1.os学习 1 print(os.name) #获取操作系统 2 print(os.path.exists("D:\soft\python")) #判断路径是否存在 3 prin ...
- 攻防世界pwn题:Recho
0x00:查看文件信息 一个64位二进制文件,canary和PIE保护机制没开. 0x01:用IDA进行静态分析 分析:主程序部分是一个while循环,判断条件是read返回值大于0则循环.函数ato ...
- (零)机器学习入门与经典算法之numpy的基本操作
1.根据索引来获取元素* 创建一个索引列表ind,用来装载索引,当numpy数据是一维数据时:一个索引对应的是一个元素具体的例子如下: import numpy as np # 数据是一维数据时:索引 ...
- P2575 高手过招 题解
题目描述 我们考虑如何把问题转换成博弈论来求解. 我们对于每一行之前都加上一个空格. 设原来这一行的空格个数是 \(C\) ,那么此时空格个数变成 \(C + 1\) . 然后按照从左到右的顺序给每一 ...
- Ros的通信第一课
//////////////////////////Ros创建发布者talker//////////////////////////////////////////////////////////// ...
- Python究竟属不属于嵌入式语言?
写在前面: 几十年来,大家普遍的认为C与C++才是标准的嵌入式语言,那么现在大火的Python算是一种嵌入式语言吗? 在给出我的答案之前我们要先明确几个问题? 什么是Python? 编程语言的定义? ...
- Android多版本flavor配置之资源文件和清单文件合并介绍
知识背景 Android studio升级到3.0之后,gradle增加了多维度管理配置,便于同一个项目中创建应用的不同版本,分别管理依赖项并签署配置.创建产品风味与创建构建类型类似:只需将它们添加到 ...
- File类创建删除功能的方法和File类遍历目录功能
File类创建删除功能的方法 public boolean createNewFile();当且仅当具有该名称的文件尚不存在的时候,创建一个新的空文件 public boolean delete(); ...
- 更换可执行文件glibc版本的某一次挣扎
0x00:前言 在做pwn的堆题时,会遇到不同版本的glibc.为此我们会装不同版本的虚拟机去应对.一般来说会装Ubuntu16和Ubuntu18虚拟机,这两个系统对应的glibc版本差别较大,且较常 ...
- YII的lazy loading
版本1 require('class\class1.php'); require('class\class1.php'); if($is_girl){ echo 'this is a girl'; $ ...