我是Hadoop和Hbase的新手。我对配置细节很困惑。我需要在Hbase中使用Java API创建表。我的本地计算机上没有软件,我正在使用Putty连接到服务器。现在我的问题是,使用本地计算机中的软件,我可以编写程序来与远程服务器进行通信。请任何人尽快消除我的疑问。
最佳答案
只需点击Zookeeper IP,然后继续进行即可。有关示例和CRUD操作,请参阅《 Hbase Definite Guide》一书。
这是通过从远程PC上访问Zookeeper IP来创建表的示例代码。
Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "192.***.*.**"); // Zookeeper IP
HBaseAdmin admin = new HBaseAdmin(config);
HTableDescriptor desc = new HTableDescriptor();
desc.setName(Bytes.toBytes("SampleTable"));
HColumnDescriptor family = new HColumnDescriptor("col1".getBytes()); //Column family name
desc.addFamily(family);
admin.createTable(desc);