Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Usage of HBase Filter (3)-bulk put Import

2025-04-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

First, apply thread import

1. Create a put method

Public class mmm {public static Configuration config=new Configuration (); static {config.set ("hbase.zookeeper.property.clientPoint", "2181"); config.set ("hbase.zookeeper.quorum", "hbase"); config.set ("dfs.socket.timeout", "180000") } public static void put (String tablename,String RowKey,String Family,String Qualifier,String Value) {HTable hull; try {h=new HTable (config,tablename); Put put=new Put (Bytes.toBytes (RowKey)); put.add (Bytes.toBytes (Family), Bytes.toBytes (Qualifier), Bytes.toBytes (Value)); h.put (put);} catch (Exception e) {e.printStackTrace () } finally {try {h.close ();} catch (IOException e) {e.printStackTrace ();}

2. Create a thread

Public class PutXX {public static void main (String [] args) {run1 r1=new run1 (); Thread rr1=new Thread (R1); rr1.start (); run2 r2=new run2 (); Thread rr2=new Thread (R2); rr2.start (); / / two threads are created here, and you need to continue to create ~}} class run1 implements Runnable {public void run () {for (int iThreads 0)

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: 264

*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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report