use of org.apache.hadoop.hbase.HBaseConfiguration in project siena by mandubian.
the class HBaseDdlGenerator method dropTables.
public void dropTables() {
HBaseConfiguration config = new HBaseConfiguration();
try {
HBaseAdmin admin = new HBaseAdmin(config);
HTableDescriptor[] descriptors = admin.listTables();
for (HTableDescriptor hTableDescriptor : descriptors) {
String name = hTableDescriptor.getNameAsString();
admin.disableTable(name);
admin.deleteTable(name);
}
} catch (IOException e) {
throw new SienaException(e);
}
}
use of org.apache.hadoop.hbase.HBaseConfiguration in project flink by apache.
the class HBaseConfigurationUtil method getHBaseConfiguration.
public static Configuration getHBaseConfiguration() {
// Instantiate an HBaseConfiguration to load the hbase-default.xml and hbase-site.xml from
// the classpath.
Configuration result = HBaseConfiguration.create();
boolean foundHBaseConfiguration = false;
// We need to load both hbase-default.xml and hbase-site.xml to the hbase configuration
// The properties of a newly added resource will override the ones in previous resources, so
// a configuration
// file with higher priority should be added later.
// Approach 1: HBASE_HOME environment variables
String possibleHBaseConfPath = null;
final String hbaseHome = System.getenv("HBASE_HOME");
if (hbaseHome != null) {
LOG.debug("Searching HBase configuration files in HBASE_HOME: {}", hbaseHome);
possibleHBaseConfPath = hbaseHome + "/conf";
}
if (possibleHBaseConfPath != null) {
foundHBaseConfiguration = addHBaseConfIfFound(result, possibleHBaseConfPath);
}
// Approach 2: HBASE_CONF_DIR environment variable
String hbaseConfDir = System.getenv("HBASE_CONF_DIR");
if (hbaseConfDir != null) {
LOG.debug("Searching HBase configuration files in HBASE_CONF_DIR: {}", hbaseConfDir);
foundHBaseConfiguration = addHBaseConfIfFound(result, hbaseConfDir) || foundHBaseConfiguration;
}
if (!foundHBaseConfiguration) {
LOG.warn("Could not find HBase configuration via any of the supported methods " + "(Flink configuration, environment variables).");
}
return result;
}
use of org.apache.hadoop.hbase.HBaseConfiguration in project Solbase by Photobucket.
the class CSVFileImporter method main.
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: java example.CSVFileImporter <csv filename>");
System.exit(0);
}
@SuppressWarnings("deprecation") HBaseConfiguration conf = new HBaseConfiguration();
conf.set("hbase.zookeeper.quorum", "localhost");
conf.set("hbase.zookeeper.property.clientPort", "2181");
conf.setInt("hbase.client.retries.number", 7);
conf.setInt("ipc.client.connect.max.retries", 3);
HTablePool hTablePool = new HTablePool(conf, 10);
try {
BufferedReader in = new BufferedReader(new FileReader(args[0]));
String str;
while ((str = in.readLine()) != null) {
process(str, hTablePool);
}
in.close();
} catch (IOException e) {
}
}
Aggregations