Reprint: http://blog.csdn.net/xiao_jun_0820/article/details/40539291
This article is based on Cloudera Manager5.0.0, and all services are based on CDH5.0.0 parcel installation.
CM installation SOLR is very convenient to add services on the cluster, Solrcloud needs zookeeper cluster support, so add the SOLR service before adding the zookeeper service. Do not repeat here.
This article starts with the addition of the SOLR service, I have 4 hosts, so I added the SOLR service when I added 4 SOLR server, one for each host, after selecting the appropriate zookeeper service to start the SOLR service, These four nodes are in the same Solrcloud cluster.
The CM-loaded SOLR service is not collection by default. We can use a scripting tool provided by Cloudera to manage Solrcloud, the tool is: Solrctl
$ solrctl--helpusage:/usr/bin/solrctl [Options] command [command-arg] [command [Command-arg]] ... Options:--SOLR solr_uri--zk zk_ensemble--help--quietcommands:init [--force] instancedir [ --generate path] [--create name path] [--update name path] [--get name Path] [--delete name] [--list] Collection [--create name-s <numShards> [-C <collection.configName> ] [-R <replicationfactor>] [-M <maxshardspernode>] [-n <createnodeset>]] [--delete name] [--reload name] [--stat name] [--deletedocs name] [--list] Core [--create name [-P name=value] ...] [--reload name] [--unload name] [--status name]
When the SOLR service starts for the first time, the/SOLR directory is created on HDFs, and the/SOLR node is created on the zookeeper, which is used to hold/SOLR-related configuration information under the Solrcloud node on the zookeeper.
Since there is no collection on the Solrcloud, we first create a collection, named Collection1, to upload the configuration information to Collection1 before creating zookeeper. We will upload the Collection1 from the SOLR directory in the examples in SOLR, which corresponds to the CM-installed cluster, which is/opt/cloudera/parcels/cdh/share/doc/ Below the SOLR-DOC-4.4.0+CDH5.0.0+178/EXAMPLE/SOLR directory, we use:
Sudo-u solr solrctl instancedir--create collection1/opt/cloudera/parcels/cdh/share/doc/solr-doc-4.4.0+cdh5.0.0+178 /example/solr/collection1
After the command is executed, the/opt/cloudera/parcels/cdh/share/doc/solr-doc-4.4.0+cdh5.0.0+178/example/solr/ All files under the Conf directory under Collection1 are uploaded below the Collection1 directory under Zookeeper/solr/configs.
OK, the configuration file is uploaded, the next step is to create the collection, run the following command:
Sudo-u SOLR solrctl Collection--create collection1-s 2
Create a collection named Collection1, there are 2 shard, we did not write the-c parameter, will use the default and collection name of the same profile directory as the default configuration of-C, The default configuration directory is also used to upload the Collection1 directory to the zookeeper as a default.
OK, we can check if collection is created successfully, run: Solrctl collection--list, see if there is Collection1
On the SOLR Console Administration page, below the cloud, you can cut down to a graphical description of the Collection1 topology, where two shard specifically assigned to which two servers are managed by Solrcloud, we do not need to care.
We tried to add a document to this collection:
Cd/opt/cloudera/parcels/cdh/share/doc/solr-doc-4.4.0+cdh5.0.0+178/example/exampledocs
Java-durl=http://master68:8983/solr/collection1/update-jar Post.jar Ipod_video.xml
Then execute the query statement: http://master68:8983/solr/collection1/select?q=*:*
We can query to the index file we added just now, so that a simple solrcloud is built.
Cloudera Search Environment Construction and construction-solrcloud