Skip to content
Snippets Groups Projects
Commit 6cd94e88 authored by Biju Nair's avatar Biju Nair
Browse files

[hbase10] changes to be able to work with secured hbase cluster

parent 025f3b4e
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@ import com.yahoo.ycsb.DBException;
import com.yahoo.ycsb.Status;
import com.yahoo.ycsb.measurements.Measurements;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
......@@ -112,6 +113,22 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB {
Durability.valueOf(getProperties().getProperty("durability"));
}
if ("kerberos".equalsIgnoreCase(config.get("hbase.security.authentication"))) {
config.set("hadoop.security.authentication", "Kerberos");
UserGroupInformation.setConfiguration(config);
}
if ((getProperties().getProperty("principal")!=null)
&& (getProperties().getProperty("keytab")!=null)) {
try {
UserGroupInformation.loginUserFromKeytab(getProperties().getProperty("principal"),
getProperties().getProperty("keytab"));
} catch (IOException e) {
System.err.println("Keytab file is not readable or not found");
throw new DBException(e);
}
}
try {
connection = ConnectionFactory.createConnection(config);
} catch (java.io.IOException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment