使用spring data hadoop连接到Cloudera QuickStart VM Hbase时出现未知主机异常
我用 我试图实现这一点 来自主机的示例将连接到VM中的Hbase以创建表、添加数据、读取数据 在我的pom中,我使用使用spring data hadoop连接到Cloudera QuickStart VM Hbase时出现未知主机异常,hbase,spring-data-hadoop,cloudera-quickstart-vm,Hbase,Spring Data Hadoop,Cloudera Quickstart Vm,我用 我试图实现这一点 来自主机的示例将连接到VM中的Hbase以创建表、添加数据、读取数据 在我的pom中,我使用 <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.version>4.0.5.RELEASE</spring.version> <spring.hadoop.vers
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>4.0.5.RELEASE</spring.version>
<spring.hadoop.version>2.1.2.RELEASE-cdh5</spring.hadoop.version>
<hadoop.version>2.5.0-cdh5.3.0</hadoop.version>
<hbase.version>0.98.6-cdh5.3.0</hbase.version>
</properties>
My application-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:hdp="http://www.springframework.org/schema/hadoop"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd">
<context:property-placeholder location="hbase.properties"/>
<context:component-scan base-package="org.springframework.samples.hadoop.hbase"/>
<hdp:configuration id="hadoopConfiguration">
fs.defaultFS=hdfs://172.30.119.25:8020
</hdp:configuration>
<hdp:hbase-configuration id="hbaseConfiguration" configuration-ref="hadoopConfiguration" zk-quorum="${hbase.zk.host}" zk-port="${hbase.zk.port}"/>
<bean id="hbaseTemplate" class="org.springframework.data.hadoop.hbase.HbaseTemplate">
<property name="configuration" ref="hbaseConfiguration"/>
</bean>
</beans>
有人能帮我解决此异常吗?如果您在虚拟机之外运行客户端,请尝试将
quickstart.cloudera
及其外部虚拟机ip添加到/etc/hosts
中
这些虚拟机通常不是为从外部使用而设计的,但cloudera的虚拟机比hortonwork的虚拟机更友好
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:hdp="http://www.springframework.org/schema/hadoop"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd">
<context:property-placeholder location="hbase.properties"/>
<context:component-scan base-package="org.springframework.samples.hadoop.hbase"/>
<hdp:configuration id="hadoopConfiguration">
fs.defaultFS=hdfs://172.30.119.25:8020
</hdp:configuration>
<hdp:hbase-configuration id="hbaseConfiguration" configuration-ref="hadoopConfiguration" zk-quorum="${hbase.zk.host}" zk-port="${hbase.zk.port}"/>
<bean id="hbaseTemplate" class="org.springframework.data.hadoop.hbase.HbaseTemplate">
<property name="configuration" ref="hbaseConfiguration"/>
</bean>
</beans>
Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=35, exceptions:
Wed Jul 15 16:01:24 ICT 2015, org.apache.hadoop.hbase.client.RpcRetryingCaller@35988e16, java.net.UnknownHostException: unknown host: quickstart.cloudera