Create a Solr Collection

Learn how to create a collection so that you can start indexing data with Solr.

  • If you have enabled Ranger for authorization, you must have Solr Admin permission to be able to create collections.
  • Before you can create a Solr collection you need to generate a collection configuration using either a config or an instance directory.
  1. If you are using Kerberos, kinit as a user with permission to create the collection:
    kinit solradmin@EXAMPLE.COM

    Replace EXAMPLE.COM with your Kerberos realm name.

  2. On a host running a Solr server, 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.

  3. Create a new collection using the following command:
    solrctl collection --create <collectionName> -s <numShards> -c <collectionConfName>


    <collectionName> User-defined name of the collection.
    <numShards> The number of shards you want to split your collection into.
    <collectionConfName> The name of an existing collection configuration.
    For example:
    solrctl collection --create logs -s 3 -c logs_config