/** * 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)); } }
/** * 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(); } }
@Override public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) { this.collector = collector; if (solrConfig.isKerberosEnabled()) { HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); } solrMapper.configure(); this.solrClient = new CloudSolrClient(solrConfig.getZkHostString()); this.toCommitTuples = new ArrayList<>(capacity()); }
protected void prepare() { if (solrConfig.isKerberosEnabled()) { HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); } solrMapper.configure(); solrClient = new CloudSolrClient(solrConfig.getZkHostString()); }
void enableKerberos() { HttpClientUtil.addConfigurer(new Krb5HttpClientConfigurer()); }
@Override public void init(Map stormConf, TopologyContext topologyContext, WriterConfiguration configurations) throws IOException, SolrServerException { Map<String, Object> globalConfiguration = configurations.getGlobalConfig(); initializeFromGlobalConfig(globalConfiguration); LOG.info("Initializing SOLR writer: {}", zookeeperUrl); LOG.info("Forcing commit per batch: {}", shouldCommit); LOG.info("Soft commit: {}", softCommit); LOG.info("Commit Wait Searcher: {}", waitSearcher); LOG.info("Commit Wait Flush: {}", waitFlush); LOG.info("Default Collection: {}", "" + defaultCollection ); if(solr == null) { if (isKerberosEnabled(stormConf)) { HttpClientUtil.addConfigurer(new Krb5HttpClientConfigurer()); } solr = new MetronSolrClient(zookeeperUrl, solrHttpConfig); } solr.setDefaultCollection(defaultCollection); }
/** * {@inheritDoc} */ @Override public void init(Map<String, Object> conf) throws ConfigException { String solrApiUrl = null; String collectionName = null; if (conf != null) { solrApiUrl = (String) conf.get(SOLR_API_URL_KEY); collectionName = (String) conf.get(COLLECTION_NAME); if (collectionName == null) { collectionName = DEFAULT_COLLECTION_NAME; } } if (solrApiUrl == null || collectionName == null) { throw new ConfigException("'solrApiUrl' must be presented in configuration."); } if ((boolean) conf.getOrDefault(SECURED_CLUSTER, false)) { HttpClientUtil.addConfigurer(new Krb5HttpClientConfigurer()); } solr = new HttpSolrClient.Builder(solrApiUrl + "/" + collectionName).build(); }
@Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.collector = collector; if (solrConfig.isKerberosEnabled()) HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); this.solrClient = new CloudSolrClient(solrConfig.getZkHostString()); this.toCommitTuples = new ArrayList<>(capacity()); }
protected void prepare() { if (solrConfig.isKerberosEnabled()) HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); solrClient = new CloudSolrClient(solrConfig.getZkHostString()); }
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); String zookeeperUrl = config.get(Solr5Index.ZOOKEEPER_URL); CloudSolrClient cloudServer = new CloudSolrClient(zookeeperUrl, true); solrClient = cloudServer; } else if (mode==Mode.HTTP) { HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); HttpClient clientParams = HttpClientUtil.createClient(new ModifiableSolrParams() {{ add(HttpClientUtil.PROP_ALLOW_COMPRESSION, config.get(HTTP_ALLOW_COMPRESSION).toString());
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); String zookeeperUrl = config.get(Solr5Index.ZOOKEEPER_URL); CloudSolrClient cloudServer = new CloudSolrClient(zookeeperUrl, true); solrClient = cloudServer; } else if (mode==Mode.HTTP) { HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer()); HttpClient clientParams = HttpClientUtil.createClient(new ModifiableSolrParams() {{ add(HttpClientUtil.PROP_ALLOW_COMPRESSION, config.get(HTTP_ALLOW_COMPRESSION).toString());