hivemetastore java_hive-metastore

#Embedded Metastore#

嵌入式metastore主要用于单元测试。同一时刻只有一个进程可以连接到metastore,所以它不是一个事实上的解决方案,但是可以很好的用于单元测试。

Derby是嵌入式metastore默认的数据库。

Config ParamConfig ValueComment
javax.jdo.option.ConnectionURLjdbc:derby:;databaseName=../build/test/junit_metastore_db;create=trueDerby数据库位置在hive/trunk/build...
javax.jdo.option.ConnectionDriverNameorg.apache.derby.jdbc.EmbeddedDriverDerby嵌入式JDBC驱动类
hive.metastore.uris本地metastore不需要设置<
hive.metastore.localtrue嵌入式是本地的
hive.metastore.warehouse.dirfile://${user.dir}/../build/ql/test/data/warehouse单元测试数据在你本地磁盘上的这个位置

If you want to run Derby as a network server so the metastore can be accessed from multiple nodes, see Hive Using Derby in Server Mode.

#Local Metastore#

在本地metastore设置中,每一个Hive客户端将会打开一个到datastore的连接并且在其上执行SQL查询。下面的配置将在一个MySQL服务器建立一个metastore。Make sure that the server is accessible from the machines where Hive queries are executed since this is a local store,并且确保JDBC客户端包在Hive客户端的classpath下。

Config ParamConfig ValueComment
javax.jdo.option.ConnectionURLjdbc:mysql://< host name>/< database name>?createDatabaseIfNotExist=truemetastore存储在MySQL服务器
javax.jdo.option.ConnectionDriverNamecom.mysql.jdbc.DriverMySQL JDBC驱动类
javax.jdo.option.ConnectionUserNameuser name连接MySQL服务器的用户名
javax.jdo.option.ConnectionPassword< password< 连接到MySQL服务器的密码
hive.metastore.uris本地metastore不需要设置<
hive.metastore.localtrue这里是本地存储
hive.metastore.warehouse.dir< base hdfs path>< Hive表的默认位置

#Remote Metastore#

在远程metastore设置中,所有Hive客户端将创建一个到metastore服务器的连接,他们轮流查询datastore(例子中是MySQL)得到metastore。Metastore服务器和客户端通过Thrift协议通信。从Hive0.5.0开始,你可以通过执行下面的命令启动一个Thrift服务:

 hive --service metastore 

在Hive 0.5.0之前的版本中,反而需要通过直接执行Java来运行一个Thrift服务。

 $JAVA_HOME/bin/java -Xmx1024m -Dlog4j.configuration=file://$HIVE_HOME/conf/hms-log4j.properties -Djava.library.path=$HADOOP_HOME/lib/native/Linux-amd64-64/ -cp $CLASSPATH org.apache.hadoop.hive.metastore.HiveMetaStore 

如果你直接执行Java ,JAVA_HOME,HIVE_HOME,HADOOP_HOME 必须设置正确,CLASSPATH必须包括Hadoop,Hive(lib and auxlib)和Java jars。

##服务端配置参数##

Config ParamConfig ValueComment
javax.jdo.option.ConnectionURLjdbc:mysql://< host name>/< database name>?createDatabaseIfNotExist=truemetastore存储在MySQL服务器
javax.jdo.option.ConnectionDriverNamecom.mysql.jdbc.DriverMySQL JDBC驱动类
javax.jdo.option.ConnectionUserNameuser name连接MySQL服务器的用户名
javax.jdo.option.ConnectionPassword< password< 连接到MySQL服务器的密码
hive.metastore.warehouse.dir< base hdfs path>< Hive表的默认位置

##客户端配置参数##

Config ParamConfig ValueComment
hive.metastore.uristhrift://<hostname>:<port>Thrift metastore 服务的host和port
hive.metastore.localfalseThis is local store. Note: This is no longer needed as of Hive 0.10. Setting hive.metastore.uris is sufficient.
hive.metastore.warehouse.dir< base hdfs path>< Hive表的默认位置

如果你使用MySQL作为metadata的datastore,在启动Hive 客户端或者HiveMetaStore服务之前将MySQL client 包将在HIVE_HOME/lib下。

要改变metastore的端口,使用下面的hive命令:

 hive --service metastore -p < port_num> 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值