hive单用户多点模式配置

简介

单用户多点模式也称远程服务模式,用户非java客户端访问元数据库,在服务端启动MetaStoreServer,客户端利用Thrift协议通过MetaStoreServer访问元数据库。

mysql安装以及配置

安装mysql

apt默认安装,占据3306端口

安装机器 : dev01

sudo apt-get install mysql-server

sudo apt-get install mysql-client

配置hive用户

  1. 登陆mysql
    mysql -u root -p xxxxxx

  2. 创建hive用户

    create user 'hive'@'%' identified by 'hive';

  3. 给hive用户权限

    grant all privileges on *.* to 'hive'@'%' with grant option;

    flush privileges;

服务端配置

修改 $HIVE_HOME/conf/hive-site.xml

<configuration>
#配置mysql
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
  <description>JDBC connect string for a JDBC metastore</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>

<property>
 <name>hive.metastore.warehouse.dir</name>
 <value>/usr/hive/warehouse</value>
</property>
# 配置MySQL的登录名和密码
<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>hive</value>
  <description>username to use against metastore database</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>hive</value>
  <description>password to use against metastore database</description>
</property>

<property>
<name>hive.exec.scratchdir</name>
<value>/usr/hive/tmp</value>
</property>

<property>
<name>hive.querylog.location</name>
<value>/usr/hive/log</value>
</property>

<property>
<name>hive.metastore.uris</name>
<value>thrift://dev01:9083</value>
</property>
</configuration>

客户端配置

修改 $HIVE_HOME/conf/hive-site.xml

<configuration>
# 9083是服务端 metastore 启动以后的默认端口
<property>
  <name>hive.metastore.uris</name>
  <value>thrift://dev01:9083</value>
  <description>IP address (or fully-qualified domain name) and port of the metastore host</description>
</property>

<property>
 <name>hive.metastore.warehouse.dir</name>
 <value>/usr/hive/warehouse</value>
</property>

<property>  
  <name>hive.metastore.local</name>  
  <value>false</value>  
</property>  

<property>
 <name>hive.exec.scratchdir</name>
 <value>/usr/hive/tmp</value>
</property>

<property>
 <name>hive.querylog.location</name>
 <value>/usr/hive/log</value>
</property>
</configuration>

启动hive

服务端

启动metastore

hive --service metastore

客户端

beeline -u jdbc:hive2://

posted @ 2018-11-28 17:42  枫子_dan  阅读(227)  评论(0编辑  收藏  举报