Create a test collection

Generate configuration files and upload the generated configuration to ZooKeeper, so that you can create a collection where you can index sample data.

  1. Make sure that the SOLR_ZK_ENSEMBLE environment variable is set in /etc/solr/conf/
    For example:
    cat /etc/solr/conf/

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

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

    Replace solr@EXAMPLE.COM with your user name and Kerberos realm name respectively.

  3. Generate configuration files for the collection:
    solrctl instancedir --generate $HOME/test_collection_config
  4. Upload the configuration to ZooKeeper:
    solrctl config --upload test_collection_config $HOME/test_collection_config
  5. 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