Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HBase Shell iterating over & truncating tables

Tags:

hbase

jruby

Trying to truncate tables like this

list.each{|name| truncate(name) if name.end_with?('abc123')}

won't work. How would one approach this?

like image 269
Jasper Avatar asked Jun 13 '26 07:06

Jasper


1 Answers

In HBase shell you can also do:

java_import org.apache.hadoop.hbase.client.HBaseAdmin
java_import org.apache.hadoop.hbase.HBaseConfiguration

admin = HBaseAdmin.new(HBaseConfiguration.create)
admin.listTables.each {|i| t=i.getNameAsString; truncate(t) if t.end_with?('abc123')} 
like image 150
Lorand Bendig Avatar answered Jun 14 '26 21:06

Lorand Bendig