2012-06-24 57 views
3

我剛開始使用hbase。我試圖執行下面的Java程序。這段代碼創建一個表並向表中添加一些值,但是我收到以下提到的錯誤。與zookeeper相關的hbase錯誤

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 [email protected] 
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) 

請人幫忙。

回答

2

org.apache.hadoop.ipc.RemoteException: Authentication is required

看起來您的客戶端沒有寫入羣集的寫入憑證。檢出the docs

+0

我能從殼做。 –

+0

如何給客戶端權限?我只是將mod 777更改爲目錄,其中Hbase將數據寫入HDFS –

1

你需要確保你有HBase的配置腳本在您的路徑(如$ HBASE_CONF目錄包含HBase的-site.xml中)和您的配置中包含的信息來訪問動物園管理員正確