3

我刚刚开始使用 hbase。我试图执行以下java程序。此代码创建一个表并向表添加一些值,但我收到以下提到的错误。

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.IOException;
public class PutExample {
public static void main(String[] args) throws IOException {
Configuration conf = HBaseConfiguration.create();
HTable table = new HTable(conf, "testtable");
Put put = new Put(Bytes.toBytes("row1"));
put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"),
Bytes.toBytes("val1"));
put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"),
Bytes.toBytes("val2"));
table.put(put);
}
}

错误:

12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/home/y/lib
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:os.arch=i386
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:os.version=2.6.18-238.1.1.el5.YAHOO.20110221
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:user.name=indirav
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:user.home=/homes/indirav
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Client environment:user.dir=/homes/indirav
12/06/24 13:11:24 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=zkp201.gold.ygrid.yahoo.com:2181,zkp200.gold.ygrid.yahoo.com:2181,zkp202.gold.ygrid.yahoo.com:2181 sessionTimeout=180000 watcher=hconnection
12/06/24 13:11:24 INFO zookeeper.ClientCnxn: Opening socket connection to server /67.195.222.180:2181
12/06/24 13:11:24 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 23935@inngw1003.gold.ygrid.yahoo.com
12/06/24 13:11:24 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: /config/jaas.config (No such file or directory) occurred when trying to find JAAS configuration.
12/06/24 13:11:24 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
12/06/24 13:11:24 WARN zookeeper.ClientCnxn: SASL authentication failed: javax.security.auth.login.LoginException: Zookeeper client cannot authenticate using the 'Client' section of the supplied JAAS configuration: '/config/jaas.config' because of a SecurityException: java.lang.SecurityException: /config/jaas.config (No such file or directory) Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.
12/06/24 13:11:24 INFO zookeeper.ClientCnxn: Socket connection established to zkp201.gold.ygrid.yahoo.com/67.195.222.180:2181, initiating session
12/06/24 13:11:24 WARN zookeeper.ClientCnxnSocket: Connected to an old server; r-o mode will be unavailable
12/06/24 13:11:24 INFO zookeeper.ClientCnxn: Session establishment complete on server zkp201.gold.ygrid.yahoo.com/67.195.222.180:2181, sessionid = 0x2349e7f54fbbd87, negotiated timeout = 40000
12/06/24 13:11:25 WARN client.HConnectionManager$HConnectionImplementation: RemoteException connecting to RS
org.apache.hadoop.ipc.RemoteException: Authentication is required
        at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:918)
        at org.apache.hadoop.hbase.ipc.SecureRpcEngine$Invoker.invoke(SecureRpcEngine.java:164)
        at $Proxy5.getProtocolVersion(Unknown Source)
        at org.apache.hadoop.hbase.ipc.SecureRpcEngine.getProxy(SecureRpcEngine.java:208)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:303)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:280)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:332)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.waitForProxy(HBaseRPC.java:236)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1278)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1235)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1222)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:918)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:814)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:782)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:915)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:818)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:782)
        at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:249)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:213)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:171)
        at PutExample.main(PutExample.java:12)

任何人请帮忙。

4

2 回答 2

2

org.apache.hadoop.ipc.RemoteException:需要身份验证

看起来您的客户端没有写入集群的写入凭据。查看文档

于 2012-06-24T13:43:10.717 回答
1

您需要确保您的路径中有 HBase 配置脚本(例如,包含 hbase-site.xml 的 $HBASE_CONF 目录)并且您的配置包含正确访问 zookeeper 的信息

于 2014-04-01T23:08:02.900 回答