Create a Test Collection

  1. If you are using Kerberos, kinit as a user that has privileges to create the collection:
    kinit solr@EXAMPLE.COM

    Replace EXAMPLE.COM with your Kerberos realm name.

  2. If you are using Kerberos, create a JAAS configuration file in your home directory ($HOME/jaas.conf) as follows:
    Client {
     com.sun.security.auth.module.Krb5LoginModule required
     useKeyTab=false
     useTicketCache=true
     principal="solr@EXAMPLE.COM";
     };
  3. Make sure that the SOLR_ZK_ENSEMBLE environment variable is set in /etc/solr/conf/solr-env.sh.
    For example:
    cat /etc/solr/conf/solr-env.sh
    export SOLR_ZK_ENSEMBLE=zk01.example.com:2181,zk02.example.com:2181,zk03.example.com:2181/solr

    This is automatically set on hosts with a Solr Server or Gateway role in Cloudera Manager.

  4. Generate configuration files for the collection:
    solrctl instancedir --generate $HOME/test_collection_config
  5. Upload the configuration to ZooKeeper:
    • Security enabled:
      solrctl --jaas $HOME/jaas.conf instancedir --create test_collection_config $HOME/test_collection_config
    • Nonsecure:
      solrctl instancedir --create test_collection_config $HOME/test_collection_config
  6. Create a new collection with two shards (specified by the -s parameter) using the named configuration (specified by the -c parameter).
    solrctl collection --create test_collection -s 2 -c test_collection_config