我试图通过Java.Here将数据写入到HBase的是我使用的代码:错误,而试图通过Java
import java.io.IOException;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.util.Bytes;
public class MyLittleHBaseClient
{
public static void main(String[] args) throws IOException
{
HBaseConfiguration config = new HBaseConfiguration();
HTable table = new HTable(config, "myLittleHBaseTable");
Put p = new Put(Bytes.toBytes("myLittleRow"));
p.add(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"),
Bytes.toBytes("Some Value"));
table.put(p);
}
}
我试图把conf.set("hbase.master","localhost:51310")
其中51310是我的HBase的主服务器运行。我区的服务器位于"localhost:13184"
。这上面的代码非常相似,我互联网上找到被HBaseConfiguration.create()
唯一“没有这样的方法”说。 遇到的错误是org.apache.hadoop.hbase.client.NoServerForRegionException:尝试定位根区域超时。我的IDE是甲骨文Jdeveloper.I添加了所有jar文件和JPS显示所有服务器上运行fine.I不知道我在做什么wrong.All的例子在互联网上展示HBaseConfiguration.create()
他们codes.I已经使用HBase的-0.90.4