Search in sources :

Example 1 with Krb5HttpClientConfigurer

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));
    }
}
Also used : Krb5HttpClientConfigurer(org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer) HttpSolrClient(org.apache.solr.client.solrj.impl.HttpSolrClient) CloudSolrClient(org.apache.solr.client.solrj.impl.CloudSolrClient)

Example 2 with Krb5HttpClientConfigurer

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();
    }
}
Also used : Krb5HttpClientConfigurer(org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer) CloudSolrClient(org.apache.solr.client.solrj.impl.CloudSolrClient)

Aggregations

CloudSolrClient (org.apache.solr.client.solrj.impl.CloudSolrClient)2 Krb5HttpClientConfigurer (org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer)2 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)1