In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Maintain tables through HBaseAdmin (create, delete tables)
Import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.hbase.HBaseConfiguration;import org.apache.hadoop.hbase.HColumnDescriptor;import org.apache.hadoop.hbase.HTableDescriptor;import org.apache.hadoop.hbase.client.HBaseAdmin;public class CreateHbaseTable {public static void main (String [] args) throws Exception {String tbl = "ericni_test"; Configuration config = HBaseConfiguration. Create (); config.set ("hbase.zookeeper.quorum", "xxxx"); config.set ("hbase.zookeeper.property.clientPort", "2181"); HBaseAdmin admin = new HBaseAdmin (config); HTableDescriptor [] tables = admin.listTables (); for (HTableDescriptor t:tables) {System. Out.println (t.getNameAsString ());} if (admin.tableExists (tbl.getBytes ("utf8") {System. Out.println ("table already exists!");} else {System. Out.println ("table not already examples create now!"); creatTable (admin,tbl,new String [] {"info"});}} public static void creatTable (HBaseAdmin admin,String tableName, String [] familys) throws Exception {HTableDescriptor tableDesc = new HTableDescriptor (tableName); for (int iTuno; I)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.