You are here

Creating Solr shards manually

You can create, configure, and register shards explicitly using ACL based hash sharding.

How to setup sharding?

For archive and workspace stores, create shards and assign shards and instances to nodes. For example, if (numShards * replicationFactor) % numNodes == 0, the following query will create the appropriate shards on any given node from a specified node set:
To put the index in a specified location set the properties as shown below:

Example: Creating shards

Let's consider an example for creating 12 shards, 2 instances of each shard, and 6 nodes. As shown below, each node will get 4 different shards.

To achieve this sharding configuration, follow the steps below:

  1. Setup and configure the Solr nodes.
    1. Set up the six Solr nodes.

      Delete the alfresco and archive cores using the following commands:

    2. Configure each Solr node and start index tracking.

      • For node 1:
      • For node 2:
      • For node 3:
      • For node 4:
      • For node 5:
      • For node 6:
    3. For each core, the properties can be set at the creation time or updated later.

      https://<host>:<port>/solr4/admin/cores?action=updateCore&storeRef=system://system&<SOME VALUE>

    You should now have six nodes with four cores, each actively tracking the repository. The following URL options are available for use:

    URL option Description Example
    numShards Specifies the number of logical shards. 12
    storeRef Specifies reference to a node store. workspace://SpacesStore
    template Defines the base configuration for a new Solr core with some configuration properties set using the URL as shown in Step 1(b).

    http://<host6>:<port6>/<base6>/admin/cores?action=newCore&storeRef=workspace://SpacesStore& numShards=12&nodeInstance=6&replicationFactor=2&numNodes=6&template=rerank

    For more information, see Core templates.

    replicationFactor Specifies the number of copies of each document (or, the number of physical instances to be created for each logical shard.) A replicationFactor of 3 means that there will be 3 instances for each logical shard. 2
    nodeInstance Specifies the Solr node instance being configured. 6
    numNodes Returns the total number of nodes. 6
    coreName Specifies the name of the Solr core. alfresco
    property.<> Specifies the property and its value.
  2. Configure Alfresco Content Services by setting the Solr subsystem properties.

    Set the three Solr subsystem properties for both the alfresco and archive cores in the file: 
    For example, set the following properties as shown below:<host1>:<port1>/<url1>,<host2>:<port2>/<url2>
    Note: These properties can also be configured via a JMX client or using the subsystem properties to reference the composite beans.
    Some important things to know:
    • If the host, port, or URL is missing, the subsystem default values (the ones set for a single index) will be used.
    • Make sure that the hosts are in the correct order. This is because Solr assumes that the shards are located on node 1, etc as defined in the above list when generating queries.
    • At query time, a Solr core is selected at random to do the distribution of all shards, again selected at random.
  3. Set the configuration properties that applies to all the cores in a Solr instance in the file.

    For shard registration, Alfresco Content Services needs to know to which Solr port the requests should be sent. This can be configured, along with an explicit host name.

    These properties will be used when registering all cores found under the <SOLR_HOME> directory. For more information, see About file.

Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.