栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Hive第二代客户端远程连接

Hive第二代客户端远程连接

目录

hive第二代客户端

 两种模式解读​

启动

相关配置文件

前提:启动hadoop集群

初始化元数据库

​踩坑

启动metastore

启动hiveserver2

远程连接 

测试 

IDEA连接hive


hive第二代客户端

hive经过发展,推出了第二代客户端beeline,但是beeline客户端不是直接访问metastore服务的,而是需要单独启动hiveserver2服务。

 

 两种模式解读

启动

二代在一代远程模式上修改,前面基础配置参考博文构建数据仓库赛题解析进行配置

相关配置文件

在hadoop中core-site.xml上添加以下内容,以实现用户代理


 
    hadoop.proxyuser.root.hosts
 
    *
 

 

 
    hadoop.proxyuser.root.groups
 
    *
 

  

master(客户端)上

hive-site.xml




    hive.metastore.warehouse.dir
    /user/hive_remote/warehouse




    hive.metastore.local
    false




    hive.metastore.uris
    thrift://slave1:9083


slave1(服务器端)上

hive-site.xml


	
    
        javax.jdo.option.ConnectionURL
        jdbc:mysql://slave2:3306/metastore?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
    
    
    
        javax.jdo.option.ConnectionUserName
        root 
    
    
    
        javax.jdo.option.ConnectionPassword
        123456
    
    
    
        javax.jdo.option.ConnectionDriverName
        com.mysql.jdbc.Driver
        
    
        
        hive.metastore.schema.verification         
		false
        
    
    
        hive.metastore.event.db.notification.api.auth
        false     
	
    
    
        hive.metastore.warehouse.dir
        /user/hive_remote/warehouse
        
    
    
        hive.server2.thrift.bind.host
        slave1
    
    
    
        hive.metastore.uris
        thrift://slave1:9083
    
		
	
	    yarn.scheduler.maximum-allocation-mb
	    10000
	


前提:启动hadoop集群

初始化元数据库
schematool -dbType mysql -initSchema

踩坑

这个是已经初始化过数据库,已经存在表metastore

解决方法

删除表再次初始化即可

 

启动metastore

操作环境:slave1(服务端)

两种方式选其中一个

前台启动  关闭ctrl+c   

bin/hive --service metastore

 ​​​​

 新开slave1窗口查看进程

后台启动 进程挂起  关闭使用jps + kill
输入命令回车执行 再次回车 进程将挂起后台

nohup bin/hive --service metastore &

启动hiveserver2

在metastore开启基础上再启动

两种方式选其中一个

前台启动  关闭ctrl+c

bin/hive --service hiveserver2

 

 新开slave1窗口查看

后台启动 进程挂起  关闭使用jps + kill
输入命令回车执行 再次回车 进程将挂起后台

nohup bin/hive --service hiveserver2 &

远程连接 

在master上使用beeline客户端进行连接访问

bin/beeline

! connect jdbc:hive2://slave1:10000

输入数据库用户名和密码

 

测试 
show databases;

IDEA连接hive

选择Apache Hive

 导入对应jar包

 测试连接

 测试

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/460265.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号