hive-3.1.3 部署 ubuntu20

准备

安装hadoop

安装hive

derby

# 上传
scp -P 22 -r D:\00garbage\big_data\hive\apache-hive-3.1.3-bin.tar.gz [email protected]:/home/mybigdata/
tar -zxvf apache-hive-3.1.3-bin.tar.gz
mv apache-hive-3.1.3 hive
# 环境变量
vim ~/.bashrc
# 初始化元数据库 (metastore)。derby 只支持单连接。报错解决 https://blog.csdn.net/qq_41918166/article/details/128748687
bin/schematool -dbType derby -initSchema
# 启动
bin/hive
# 测试
hive> show databases;
hive> show tables;
hive> create table student(id int, name string);
hive> insert into student values(1,"xcrj");
hive> select * from student;
# web访问hdfs
http://h01:9870/explorer.html#/
输入 /user/hive/warehouse/student

~/.bashrc 添加

#HIVE_HOME
export HIVE_HOME=/home/mybigdata/hive
export PATH=$PATH:$HIVE_HOME/bin

mysql

先清空 derby

quit;
rm -rf derby.log metastore_db
hadoop fs -rm -r /user

docker安装mysql

sudo docker pull mysql:5.7.40
sudo docker run -itd --name mysql57 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7.40
docker exec -it mysql57 /bin/bash
mysql -uroot -p
create database metastore;

配置

# 配置
vim $HIVE_HOME/conf/hive-site.xml
# 初始化元数据库 (metastore)
bin/schematool -dbType mysql -initSchema -verbose
# 启动
bin/hive
# 测试1
hive> show databases;
hive> show tables;
hive> create table student(id int, name string);
hive> insert into student values(1,"xcrj");
hive> select * from student;
# 测试2,查看MySQL metastore库 元数据
use metastore;
show tables;
select * from DBS;
select * from TBLS;
select * from COLUMNS_V2;
# web访问hdfs
http://h01:9870/explorer.html#/
输入 /user/hive/warehouse/student

hive-site.xml



<configuration>
    
    <property>
        <name>javax.jdo.option.ConnectionURLname>
        <value>jdbc:mysql://h01:3306/metastore?useSSL=falsevalue>
    property>
    
    <property>
        <name>javax.jdo.option.ConnectionDriverNamename>
        <value>com.mysql.jdbc.Drivervalue>
    property>
	
    <property>
        <name>javax.jdo.option.ConnectionUserNamename>
        <value>rootvalue>
    property>
    
    <property>
        <name>javax.jdo.option.ConnectionPasswordname>
        <value>123456value>
    property>
    
    <property>
        <name>hive.metastore.warehouse.dirname>
        <value>/user/hive/warehousevalue>
    property>
configuration>

hive.log位置

cd /tmp/mybigdata/
tail -f hive.log

你可能感兴趣的:(hive,hadoop,数据仓库)