11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

User permissions on "create"<br />

When using the "create" command, be sure that you run this command as the same user that you use to<br />

start <strong>Solr</strong>. If you use the UNIX/Linux install script, this will normally be a user named "solr". If <strong>Solr</strong> is<br />

running as the solr user but you use root to create a core, then <strong>Solr</strong> will not be able to write to the<br />

directories created by the start script.<br />

If you are running in cloud mode, this very likely will not be a problem. In cloud mode, all the<br />

configuration is stored in ZooKeeper, and the create script does not need to make directories or copy<br />

configuration files. <strong>Solr</strong> itself will create all the necessary directories.<br />

The create command detects the mode that <strong>Solr</strong> is running in (standalone or <strong>Solr</strong>Cloud) and then creates a core<br />

or collection depending on the mode.<br />

bin/solr create options<br />

bin/solr create -help<br />

Available Parameters<br />

Parameter Description Example<br />

-c Name of the core or collection to create (required). bin/solr<br />

create -c<br />

mycollection<br />

-d The configuration directory. This defaults to data_driven_schema_<br />

configs.<br />

See the section Configuration Directories and <strong>Solr</strong>Cloud below for<br />

more details about this option when running in <strong>Solr</strong>Cloud mode.<br />

-n The configuration name. This defaults to the same name as the core<br />

or collection.<br />

-p Port of a local <strong>Solr</strong> instance to send the create command to; by default<br />

the script tries to detect the port by looking for running <strong>Solr</strong> instances.<br />

This option is useful if you are running multiple standalone <strong>Solr</strong><br />

instances on the same host, thus requiring you to be specific about<br />

which instance to create the core in.<br />

bin/solr<br />

create -d<br />

basic_configs<br />

bin/solr<br />

create -n<br />

basic<br />

bin/solr<br />

create -p<br />

8983<br />

-s <br />

-shards<br />

-rf <br />

-replicationFactor<br />

Number of shards to split a collection into, default is 1; only applies<br />

when <strong>Solr</strong> is running in <strong>Solr</strong>Cloud mode.<br />

Number of copies of each document in the collection. The default is 1<br />

(no replication).<br />

bin/solr<br />

create -s 2<br />

bin/solr<br />

create -rf 2<br />

Configuration Directories and <strong>Solr</strong>Cloud<br />

Before creating a collection in <strong>Solr</strong>Cloud, the configuration directory used by the collection must be uploaded to<br />

ZooKeeper. The create command supports several use cases for how collections and configuration directories<br />

work. The main decision you need to make is whether a configuration directory in ZooKeeper should be shared<br />

across multiple collections. Let's work through a few examples to illustrate how configuration directories work in<br />

<strong>Solr</strong>Cloud.<br />

First, if you don't provide the -d or -n options, then the default configuration ( $SOLR_HOME/server/solr/con<br />

figsets/data_driven_schema_configs/conf) is uploaded to ZooKeeper using the same name as the<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!