Hive集群环境搭建之本地模式(derby)
程序员文章站
2022-03-08 09:43:09
...
搭建集群的模式有三种
Hive的原理详解
1. 源码包下载及解压
http://mirror.bit.edu.cn/apache/hive/
2. 集群的环境
… | Active NameNode | Standby NameNode | DataNode | Zookeeper | ZKFC | JournalNode | ResourceManage | NodeManager |
---|---|---|---|---|---|---|---|---|
node01 | √ | - | - | - | √ | √ | √ | |
node02 | - | √ | √ | √ | √ | √ | √ | √ |
node03 | - | - | √ | √ | - | √ | √ | |
node04 | - | - | √ | √ | - | - | √ |
3. 修改hive-site.xml文件
需要注意,刚开始解压的包是没有hive-site.xml文件的,需要把hive-site.xml.template文件复制一份为hive-site.xml.
此文件在/conf文件夹中
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=metastore_db;create=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>true</value>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
</configuration>
4.遇到的坑
1.虽然配置文件配置好了但是因为Hive的lib下的Jline.jar与/hadoop-2.6.5/share/hadoop/yarn/lib下的Jline.jar包版本不一样,就会出现错误。
解决办法:一般来说Hive的Jline.jar包是新版本,把这个包覆盖Hadoop里面的这个包。
ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
2.使用derby存储方式时,运行hive会在当前目录生成一个derby文件和一个metastore_db目录。这种存储方式的弊端是在同一个目录下同时只能有一个hive客户端能使用数据库,否则会提示如下错误
[html] view plaincopyprint?
hive> show tables;
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database 'metastore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database 'metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
hive> show tables;
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database 'metastore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database 'metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
5. 启动Hive
$HIVE_HOME/bin/hive
总结
总体来说这种方法根本不常用;因为他不会支持多用户的操作。