use of org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer in project YCSB by brianfrankcooper.
the class SolrClient method init.
/**
* Initialize any state for this DB. Called once per DB instance; there is one DB instance per
* client thread.
*/
@Override
public void init() throws DBException {
Properties props = getProperties();
commitTime = Integer.parseInt(props.getProperty("solr.commit.within.time", DEFAULT_COMMIT_WITHIN_TIME));
batchMode = Boolean.parseBoolean(props.getProperty("solr.batch.mode", DEFAULT_BATCH_MODE));
String jaasConfPath = props.getProperty("solr.jaas.conf.path");
if (jaasConfPath != null) {
System.setProperty("java.security.auth.login.config", jaasConfPath);
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
}
// Check if Solr cluster is running in SolrCloud or Stand-alone mode
Boolean cloudMode = Boolean.parseBoolean(props.getProperty("solr.cloud", DEFAULT_CLOUD_MODE));
System.err.println("Solr Cloud Mode = " + cloudMode);
if (cloudMode) {
System.err.println("Solr Zookeeper Remote Hosts = " + props.getProperty("solr.zookeeper.hosts", DEFAULT_ZOOKEEPER_HOSTS));
client = new CloudSolrClient(props.getProperty("solr.zookeeper.hosts", DEFAULT_ZOOKEEPER_HOSTS));
} else {
client = new HttpSolrClient(props.getProperty("solr.base.url", DEFAULT_SOLR_BASE_URL));
}
}
use of org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer in project YCSB by brianfrankcooper.
the class SolrClient method init.
/**
* Initialize any state for this DB. Called once per DB instance; there is one DB instance per
* client thread.
*/
@Override
public void init() throws DBException {
Properties props = getProperties();
commitTime = Integer.parseInt(props.getProperty("solr.commit.within.time", DEFAULT_COMMIT_WITHIN_TIME));
batchMode = Boolean.parseBoolean(props.getProperty("solr.batch.mode", DEFAULT_BATCH_MODE));
String jaasConfPath = props.getProperty("solr.jaas.conf.path");
if (jaasConfPath != null) {
System.setProperty("java.security.auth.login.config", jaasConfPath);
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
}
// Check if Solr cluster is running in SolrCloud or Stand-alone mode
Boolean cloudMode = Boolean.parseBoolean(props.getProperty("solr.cloud", DEFAULT_CLOUD_MODE));
System.err.println("Solr Cloud Mode = " + cloudMode);
if (cloudMode) {
System.err.println("Solr Zookeeper Remote Hosts = " + props.getProperty("solr.zookeeper.hosts", DEFAULT_ZOOKEEPER_HOSTS));
client = new CloudSolrClient.Builder().withZkHost(Arrays.asList(props.getProperty("solr.zookeeper.hosts", DEFAULT_ZOOKEEPER_HOSTS).split(","))).build();
} else {
client = new HttpSolrClient.Builder(props.getProperty("solr.base.url", DEFAULT_SOLR_BASE_URL)).build();
}
}
Aggregations