我試圖創建一個使用Java API中的HBase的表,我可以連接到飼養員可以通過Java API的連接到HBase的,但不能創建表
2016-11-06 15:18:36 INFO RecoverableZooKeeper:120 - Process identifier=hconnection-0x382db087 connecting to ZooKeeper ensemble=138.68.147.208:2181
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:host.name=olivers-air.default
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:java.version=1.8.0_45
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:java.vendor=Oracle Corporation
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:java.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/tools.jar:/Users/oliverbuckley-salmon/IdeaProjects/sandpit/database/target/classes:/Users/oliverbuckley-salmon/IdeaProjects/sandpit/domain/target/classes:/Users/oliverbuckley-salmon/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hbase/hbase-client/1.2.3/hbase-client-1.2.3.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hbase/hbase-annotations/1.2.3/hbase-annotations-1.2.3.jar:/Users/oliverbuckley-salmon/.m2/repository/com/github/stephenc/findbugs/findbugs-annotations/1.3.9-1/findbugs-annotations-1.3.9-1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hbase/hbase-common/1.2.3/hbase-common-1.2.3.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/oliverbuckley-salmon/.m2/repository/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hbase/hbase-protocol/1.2.3/hbase-protocol-1.2.3.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/oliverbuckley-salmon/.m2/repository/com/google/guava/guava/12.0.1/guava-12.0.1.jar:/Users/oliverbuckley-salmon/.m2/repository/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar:/Users/oliverbuckley-salmon/.m2/repository/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/zookeeper/zookeeper/3.4.6/zookeeper-3.4.6.jar:/Users/oliverbuckley-salmon/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/htrace/htrace-core/3.1.0-incubating/htrace-core-3.1.0-incubating.jar:/Users/oliverbuckley-salmon/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar:/Users/oliverbuckley-salmon/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.jar:/Users/oliverbuckley-salmon/.m2/repository/org/jruby/jcodings/jcodings/1.0.8/jcodings-1.0.8.jar:/Users/oliverbuckley-salmon/.m2/repository/org/jruby/joni/joni/2.1.2/joni-2.1.2.jar:/Users/oliverbuckley-salmon/.m2/repository/com/yammer/metrics/metrics-core/2.2.0/metrics-core-2.2.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hadoop/hadoop-auth/2.5.1/hadoop-auth-2.5.1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/httpcomponents/httpclient/4.2.5/httpclient-4.2.5.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/httpcomponents/httpcore/4.2.4/httpcore-4.2.4.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/directory/server/apacheds-kerberos-codec/2.0.0-M15/apacheds-kerberos-codec-2.0.0-M15.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/directory/server/apacheds-i18n/2.0.0-M15/apacheds-i18n-2.0.0-M15.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/directory/api/api-asn1-api/1.0.0-M20/api-asn1-api-1.0.0-M20.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/directory/api/api-util/1.0.0-M20/api-util-1.0.0-M20.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hadoop/hadoop-common/2.5.1/hadoop-common-2.5.1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hadoop/hadoop-annotations/2.5.1/hadoop-annotations-2.5.1.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/commons/commons-math3/3.1.1/commons-math3-3.1.1.jar:/Users/oliverbuckley-salmon/.m2/repository/xmlenc/xmlenc/0.52/xmlenc-0.52.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-net/commons-net/3.1/commons-net-3.1.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-el/commons-el/1.0/commons-el-1.0.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/Users/oliverbuckley-salmon/.m2/repository/commons-beanutils/commons-beanutils-core/1.8.0/commons-beanutils-core-1.8.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/avro/avro/1.7.4/avro-1.7.4.jar:/Users/oliverbuckley-salmon/.m2/repository/com/thoughtworks/paranamer/paranamer/2.3/paranamer-2.3.jar:/Users/oliverbuckley-salmon/.m2/repository/org/xerial/snappy/snappy-java/1.0.4.1/snappy-java-1.0.4.1.jar:/Users/oliverbuckley-salmon/.m2/repository/com/jcraft/jsch/0.1.42/jsch-0.1.42.jar:/Users/oliverbuckley-salmon/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/commons/commons-compress/1.4.1/commons-compress-1.4.1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/tukaani/xz/1.0/xz-1.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hadoop/hadoop-mapreduce-client-core/2.5.1/hadoop-mapreduce-client-core-2.5.1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hadoop/hadoop-yarn-common/2.5.1/hadoop-yarn-common-2.5.1.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/hadoop/hadoop-yarn-api/2.5.1/hadoop-yarn-api-2.5.1.jar:/Users/oliverbuckley-salmon/.m2/repository/javax/xml/bind/jaxb-api/2.2.2/jaxb-api-2.2.2.jar:/Users/oliverbuckley-salmon/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/Users/oliverbuckley-salmon/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/oliverbuckley-salmon/.m2/repository/io/netty/netty/3.6.2.Final/netty-3.6.2.Final.jar:/Users/oliverbuckley-salmon/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/Users/oliverbuckley-salmon/.m2/repository/com/hazelcast/hazelcast-all/3.7.2/hazelcast-all-3.7.2.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/curator/curator-framework/2.10.0/curator-framework-2.10.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/curator/curator-client/2.10.0/curator-client-2.10.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/curator/curator-x-discovery/2.10.0/curator-x-discovery-2.10.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/curator/curator-recipes/2.10.0/curator-recipes-2.10.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/curator/curator-test/2.10.0/curator-test-2.10.0.jar:/Users/oliverbuckley-salmon/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar:/Users/oliverbuckley-salmon/.m2/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar:/Users/oliverbuckley-salmon/.m2/repository/com/hazelcast/hazelcast-zookeeper/3.6.1/hazelcast-zookeeper-3.6.1.jar:/Users/oliverbuckley-salmon/.m2/repository/joda-time/joda-time/2.9.4/joda-time-2.9.4.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:java.library.path=/Users/oliverbuckley-salmon/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:java.io.tmpdir=/var/folders/sx/g9vbcw9d3j54gtj89n57g1fw0000gn/T/
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:java.compiler=<NA>
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:os.name=Mac OS X
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:os.arch=x86_64
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:os.version=10.11.6
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:user.name=oliverbuckley-salmon
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:user.home=/Users/oliverbuckley-salmon
2016-11-06 15:18:36 INFO ZooKeeper:100 - Client environment:user.dir=/Users/oliverbuckley-salmon/IdeaProjects/sandpit
2016-11-06 15:18:36 INFO ZooKeeper:438 - Initiating client connection, connectString=138.68.147.208:2181 sessionTimeout=90000 watcher=hconnection-0x382db0870x0, quorum=138.68.147.208:2181, baseZNode=/hbase
2016-11-06 15:18:37 INFO ClientCnxn:975 - Opening socket connection to server 138.68.147.208/138.68.147.208:2181. Will not attempt to authenticate using SASL (unknown error)
2016-11-06 15:18:37 INFO ClientCnxn:852 - Socket connection established to 138.68.147.208/138.68.147.208:2181, initiating session
2016-11-06 15:18:37 INFO ClientCnxn:1235 - Session establishment complete on server 138.68.147.208/138.68.147.208:2181, sessionid = 0x158273e5275001d, negotiated timeout = 90000
,因爲我可以我可以連接到HBase的看到它在調試器,但是當我嘗試後,35重試創建失敗的表
org.apache.hadoop.hbase.MasterNotRunningException: java.net.UnknownHostException
我可以與UI連接到HBase的,可以看到主人和地區服務器。
我的代碼看起來像這樣
Configuration hBaseConfig = HBaseConfiguration.create();
hBaseConfig.setInt("timeout", 120000);
hBaseConfig.set("hbase.master", hbaseHost + ":60000");
hBaseConfig.set("hbase.zookeeper.quorum",zookeeperHost);
hBaseConfig.set("hbase.zookeeper.property.clientPort", "2181");
logger.info("Trying to connect to HBase");
Connection connection = ConnectionFactory.createConnection(hBaseConfig);
Admin admin = connection.getAdmin();
logger.info("Connected to HBase");
logger.info("Trying to create tables");
createSchemaTables(admin);
logger.info("Tables created");
CreateSchemaTables看起來像這樣
public static void createSchemaTables(Admin admin) throws IOException {
HTableDescriptor table = new HTableDescriptor(TableName.valueOf(tableName));
HColumnDescriptor cf = new HColumnDescriptor(columnFamily).setCompressionType(Algorithm.NONE);
table.addFamily(cf);
System.out.print("Creating table. ");
admin.createTable(table);
System.out.println(" Done.");
客戶端是我的Mac上運行的空氣和HBase的是在數字海洋運行。
有沒有人有任何想法,爲什麼我可以連接到HBase但不創建表?
預先感謝您的幫助, 奧利弗
你如何解決olivers-air.default?你的主機文件如何看起來像? –
## #主機數據庫 # #當系統引導時,#localhost用於配置環回接口 #。不要更改此條目。 '## 127.0.0.1 \t本地主機 255.255.255.255 \t broadcasthost :: 1 localhost' 不知道這是雖然 – olibs
@Sergio蒙託羅的問題,如果你已經看到了這個問題之前,雖然我會歡迎任何意見,我很難過。謝謝你的幫助。 – olibs