Cloudera Search
Cloudera Search
Important Notice
Cloudera, the Cloudera logo, Cloudera Impala, and any other product or service
names or slogans contained in this document are trademarks of Cloudera and its
suppliers or licensors, and may not be copied, imitated or used, in whole or in part,
without the prior written permission of Cloudera or the applicable trademark holder.
Hadoop and the Hadoop elephant logo are trademarks of the Apache Software
Foundation. All other trademarks, registered trademarks, product names and
company names or logos mentioned in this document are the property of their
respective owners. Reference to any products, services, processes or other
information, by trade name, trademark, manufacturer, supplier or otherwise does
not constitute or imply endorsement, sponsorship or recommendation thereof by
us.
Complying with all applicable copyright laws is the responsibility of the user. Without
limiting the rights under copyright, no part of this document may be reproduced,
stored in or introduced into a retrieval system, or transmitted in any form or by any
means (electronic, mechanical, photocopying, recording, or otherwise), or for any
purpose, without the express written permission of Cloudera.
Cloudera, Inc.
1001 Page Mill Road Bldg 2
Palo Alto, CA 94304
[email protected]
US: 1-888-789-1488
Intl: 1-650-362-0488
www.cloudera.com
Release Information
Version: 5.4.x
Date: May 20, 2015
Table of Contents
Search Installation...................................................................................................10
About this Guide........................................................................................................................................10
Preparing to Install Cloudera Search ......................................................................................................10
Cloudera Search Requirements.............................................................................................................................10
Choosing Where to Deploy the Cloudera Search Processes..............................................................................12
Guidelines for Deploying Cloudera Search...........................................................................................................12
Installing Cloudera Search........................................................................................................................14
Installing Cloudera Search with Cloudera Manager............................................................................................15
Installing Cloudera Search without Cloudera Manager .....................................................................................15
Deploying Cloudera Search....................................................................................................................................16
Installing the Spark Indexer...................................................................................................................................21
Installing MapReduce Tools for use with Cloudera Search................................................................................21
Installing the Lily HBase Indexer Service.............................................................................................................21
Upgrading Cloudera Search......................................................................................................................22
Upgrading to the Latest Search 1.x......................................................................................................................23
Upgrading Search 1.x to Search for CDH 5...........................................................................................................26
Installing Hue Search................................................................................................................................27
Updating Hue Search..............................................................................................................................................28
Cloudera Search Version and Download Information............................................................................28
Search Download Information..............................................................................................................................29
Prerequisites
Before installing Search, install Cloudera Manager and a CDH cluster. The scenario in this guide works with CDH
5.4.x and Cloudera Manager 5.4.x. The quickstart.sh script and supporting files are included with CDH. Install
Cloudera Manager, CDH, and Solr using the Cloudera Manager and CDH QuickStart Guide.
The primary services that the Search Quick Start depends on are:
• HDFS: Stores data. Deploy on all hosts.
• ZooKeeper: Coordinates Solr hosts. Deploy on one host. Use default port 2181. The examples refer to a
machine named search-zk. You may want to give your Zookeeper machine this name to simplify reusing
content exactly as it appears in this document. If you choose a different name, you must adjust some
commands accordingly.
• Solr with SolrCloud: Provides search services such as document indexing and querying. Deploy on two hosts.
• Hue: Includes the Search application, which you can use to complete search queries. Deploy Hue on one host.
After you have completed the installation processes outlined in the Cloudera Manager Quick Start Guide, you
can Load and Index Data in Search on page 7.
The script uses several defaults that you might want to modify:
Cloudera Search | 7
Cloudera Search QuickStart Guide
ZOOKEEPER_PORT 2181
ZOOKEEPER_ROOT /solr
HDFS_USER ${HDFS_USER:="${USER}"}
SOLR_HOME /opt/cloudera/parcels/SOLR/lib/solr
By default, the script is configured to run on the NameNode host, which is also running ZooKeeper. Override
these defaults with custom values when you start quickstart.sh. For example, to use an alternate NameNode
and HDFS user ID, you could start the script as follows:
The first time the script runs, it downloads required files such as the Enron data and configuration files. If you
run the script again, it uses the Enron information already downloaded, as opposed to downloading this
information again. On such subsequent runs, the existing data is used to re-create the enron-email-collection
SolrCloud collection.
Note: Downloading the data from its server, expanding the data, and uploading the data can be time
consuming. Although your connection and CPU speed determine the time these processes require,
fifteen minutes is typical and longer is not uncommon.
The script also generates a Solr configuration and creates a collection in SolrCloud. The following sections
describes what the script does and how you can complete these steps manually, if desired. The script completes
the following tasks:
1. Set variables such as hostnames and directories.
2. Create a directory to which to copy the Enron data and then copy that data to this location. This data is about
422 MB and in some tests took about five minutes to download and two minutes to untar.
3. Create directories for the current user in HDFS, change ownership of that directory to the current user, create
a directory for the Enron data, and load the Enron data to that directory. In some tests, it took about a minute
to copy approximately 3 GB of untarred data.
4. Use solrctl to create a template of the instance directory.
5. Use solrctl to create a new Solr collection for the Enron mail collection.
6. Create a directory to which the MapReduceBatchIndexer can write results. Ensure that the directory is empty.
7. Use the MapReduceIndexerTool to index the Enron data and push the result live to enron-mail-collection.
In some tests, it took about seven minutes to complete this task.
8 | Cloudera Search
Cloudera Search QuickStart Guide
4. (Optional) Click the Enroncollection to configure how the search results display. For more information, see
Hue Configuration.
5. Type a search string in the Search... text box and press Enter.
6. Review the results of your Search.
For more information, see:
• Cloudera Search Frequently Asked Questions
• Cloudera Search Release Notes on page 124
• Hue Project
Cloudera Search | 9
Search Installation
Search Installation
This documentation describes how to install Cloudera Search powered by Solr. It also explains how to install
and start supporting tools and services such as the ZooKeeper Server, MapReduce tools for use with Cloudera
Search, and Flume Solr Sink.
After installing Cloudera Search as described in this document, you can configure and use Cloudera Search as
described in the Cloudera Search User Guide on page 31. The user guide includes the Cloudera Search Tutorial
on page 38, as well as topics that describe extracting, transforming, and loading data, establishing high availability,
and troubleshooting.
Cloudera Search documentation includes:
• Cloudera Search Release Notes on page 124
• Cloudera Search Version and Download Information on page 28
• Cloudera Search User Guide on page 31
• Cloudera Search Frequently Asked Questions
10 | Cloudera Search
Search Installation
Operating Systems
Cloudera Search provides packages for RHEL, SLES, Ubuntu, and Debian systems as described below. All packages
are 64-bit.
6.2
6.4
CentOS 5.7
6.2
6.4
Oracle Linux with Unbreakable Enterprise Kernel 5.6
6.4
SLES
Ubuntu/Debian
Note:
• Cloudera has received reports that our RPMs work well on Fedora, but we have not tested this.
• If you are using an operating system that is not supported by Cloudera's packages, you can also
download source tarballs from Downloads.
JDK
• Cloudera Search 1.3 works with Oracle JDK 1.6 and Oracle JDK 1.7:
– Cloudera Search works with JDK 1.6. Search is certified with 1.6.0_31, but any later maintenance (_xx)
release should be acceptable for production, following Oracle's release notes and restrictions. The minimum
supported version is 1.6.0_8.
– Cloudera Search works with JDK 1.7. Search is certified with 1.7.0_25 or 1.7.0_45, but any later maintenance
(_xx) release should be acceptable for production, following Oracle's release notes and restrictions.
Cloudera Search | 11
Search Installation
Note:
Cloudera Search supports running applications compiled with Oracle JDK 7 (JDK 1.7) with the following
restrictions:
• All CDH components must be running the same major version (that is, all deployed on JDK 6 or all
deployed on JDK 7). For example, you cannot run Hadoop on JDK 6 while running Sqoop on JDK 7.
• All hosts in the cluster must be running the same major JDK version: Cloudera does not support
mixed environments (some hosts on JDK6 and others on JDK7).
To make sure everything works correctly, symbolically link the directory where you install the JDK to
/usr/java/default on Red Hat and similar systems, or to /usr/lib/jvm/default-java on Ubuntu
and Debian systems.
Memory
CDH initially deploys Solr with a Java virtual machine (JVM) size of 1 GB. In the context of Search, 1 GB is a small
value. Starting with this small value simplifies JVM deployment, but the value is insufficient for most actual use
cases. Consider the following when determining an optimal JVM size for production usage:
• The more searchable material you have, the more memory you need. All things being equal, 10 TB of searchable
data requires more memory than 1 TB of searchable data.
• What is indexed in the searchable material. Indexing all fields in a collection of logs, email messages, or
Wikipedia entries requires more memory than indexing only the Date Created field.
• The level of performance required. If the system must be stable and respond quickly, more memory may
help. If slow responses are acceptable, you may be able to use less memory.
12 | Cloudera Search
Search Installation
To ensure an appropriate amount of memory, consider your requirements and experiment in your environment.
In general:
• 4 GB is sufficient for some smaller loads or for evaluation.
• 12 GB is sufficient for some production environments.
• 48 GB is sufficient for most situations.
Deployment Requirements
The information in this topic should be considered as guidance instead of absolute requirements. Using a sample
application to benchmark different use cases and data types and sizes can help you identify the most important
performance factors.
To determine how best to deploy search in your environment, define use cases. The same Solr index can have
very different hardware requirements, depending on queries performed. The most common variation in hardware
requirement is memory. For example, the memory requirements for faceting vary depending on the number of
unique terms in the faceted field. Suppose you want to use faceting on a field that has ten unique values. In
this case, only ten logical containers are required for counting. No matter how many documents are in the index,
memory overhead is almost nonexistent.
Conversely, the same index could have unique timestamps for every entry, and you want to facet on that field
with a : -type query. In this case, each index requires its own logical container. With this organization, if you
had a large number of documents—500 million, for example—then faceting across 10 fields would increase the
RAM requirements significantly.
For this reason, use cases and some characterizations of the data is required before you can estimate hardware
requirements. Important parameters to consider are:
• Number of documents. For Cloudera Search, sharding is almost always required.
• Approximate word count for each potential field.
• What information is stored in the Solr index and what information is only for searching. Information stored
in the index is returned with the search results.
• Foreign language support:
– How many different languages appear in your data?
– What percentage of documents are in each language?
– Is language-specific search supported? This determines whether accent folding and storing the text in a
single field is sufficient.
– What language families will be searched? For example, you could combine all Western European languages
into a single field, but combining English and Chinese into a single field is not practical. Even with more
similar sets of languages, using a single field for different languages can be problematic. For example,
sometimes accents alter the meaning of a word, and in such a case, accent folding loses important
distinctions.
• Faceting requirements:
– Be wary of faceting on fields that have many unique terms. For example, faceting on timestamps or
free-text fields typically has a high cost. Faceting on a field with more than 10,000 unique values is typically
not useful. Ensure that any such faceting requirement is necessary.
– What types of facets are needed? You can facet on queries as well as field values. Faceting on queries is
often useful for dates. For example, “in the last day” or “in the last week” can be valuable. Using Solr Date
Math to facet on a bare “NOW” is almost always inefficient. Facet-by-query is not memory-intensive
because the number of logical containers is limited by the number of queries specified, no matter how
many unique values are in the underlying field. This can enable faceting on fields that contain information
such as dates or times, while avoiding the problem described for faceting on fields with unique terms.
• Sorting requirements:
– Sorting requires one integer for each document (maxDoc), which can take up significant memory.
Additionally, sorting on strings requires storing each unique string value.
Cloudera Search | 13
Search Installation
• Is an “advanced” search capability planned? If so, how will it be implemented? Significant design decisions
depend on user motivation levels:
– Can users be expected to learn about the system? “Advanced” screens could intimidate e-commerce
users, but these screens may be most effective if users can be expected to learn them.
– How long will your users wait for results? Data mining results in longer user wait times. You want to limit
user wait times, but other design requirements can affect response times.
• How many simultaneous users must your system accommodate?
• Update requirements. An update in Solr refers both to adding new documents and changing existing
documents:
– Loading new documents:
– Bulk. Will the index be rebuilt from scratch in some cases, or will there only be an initial load?
– Incremental. At what rate will new documents enter the system?
– Updating documents. Can you characterize the expected number of modifications to existing documents?
– How much latency is acceptable between when a document is added to Solr and when it is available in
Search results?
• Security requirements. Solr has no built-in security options, although Cloudera Search supports authentication
using Kerberos and authorization using Sentry. In Solr, document-level security is usually best accomplished
by indexing authorization tokens with the document. The number of authorization tokens applied to a
document is largely irrelevant; for example, thousands are reasonable but can be difficult to administer. The
number of authorization tokens associated with a particular user should be no more than 100 in most cases.
Security at this level is often enforced by appending an “fq” clause to the query, and adding thousands of
tokens in an “fq” clause is expensive.
– A post filter, also know as a no-cache filter, can help with access schemes that cannot use an "fq" clause.
These are not cached and are applied only after all less-expensive filters are applied.
– If grouping, faceting is not required to accurately reflect true document counts, so you can use some
shortcuts. For example, ACL filtering is expensive in some systems, sometimes requiring database access.
If completely accurate faceting is required, you must completely process the list to reflect accurate facets.
• Required query rate, usually measured in queries-per-second (QPS):
– At a minimum, deploy machines with sufficient hardware resources to provide an acceptable response
rate for a single user. You can create queries that burden the system so much that performance for even
a small number of users is unacceptable. In this case, resharding is necessary.
– If QPS is only somewhat slower than required and you do not want to reshard, you can improve performance
by adding replicas to each shard.
– As the number of shards in your deployment increases, so too does the likelihood that one of the shards
will be unusually slow. In this case, the general QPS rate falls, although very slowly. This typically occurs
as the number of shards reaches the hundreds.
14 | Cloudera Search
Search Installation
Note: Depending on which installation approach you use, Search is installed to different locations.
• Installing Search with Cloudera Manager using parcels results in changes under
/opt/cloudera/parcels.
• Installing using packages, either manually or using Cloudera Manager, results in changes to various
locations throughout the file system. Common locations for changes include /usr/lib/,
/etc/default/, and /usr/share/doc/.
Note: This page describe how to install CDH using packages as well as how to install CDH using
Cloudera Manager.
You can also install Cloudera Search manually in some situations; for example, y if you have an existing installation
to which you want to add Search.
To use Cloudera Search 1.3 with CDH 4:
• For general information about using repositories to install or upgrade Cloudera software, see Understanding
Custom Installation Solutions in Understanding Custom Installation Solutions.
• For instructions on installing or upgrading CDH, see CDH 4 Installation and the instructions for Upgrading
from CDH3 to CDH 4 or to see information on upgrading from an earlier CDH 4 release, see Upgrading to the
Latest Version of CDH 4.
• For Cloudera Search repository locations and client .repo files, see Cloudera Search Version and Download
Information.
Cloudera Search provides the following packages:
solr Solr
Cloudera Search | 15
Search Installation
Important:
• Running services: When starting, stopping, and restarting CDH components, always use the
service (8) command instead of running /etc/init.d scripts directly. This is important because
service sets the current working directory to the root directory (/) and removes environment
variables except LANG and TERM. This creates a predictable environment in which to administer
the service. If you use /etc/init.d scripts directly, any environment variables continue to be
applied, potentially causing unexpected results. If you install CDH from packages, service is
installed as part of the Linux Standard Base (LSB).
• Install the Cloudera repository: Before using the instructions in this guide to install or upgrade
Cloudera Search from packages, install the Cloudera yum, zypper/YaST or apt repository, and
install or upgrade CDH and make sure it is functioning correctly.
Cloudera Search packages are configured according to the Linux Filesystem Hierarchy Standard.
Next, enable the server daemons you want to use with Hadoop. You can also enable Java-based client access
by adding the JAR files in /usr/lib/solr/ and /usr/lib/solr/lib/ to your Java class path.
16 | Cloudera Search
Search Installation
Initializing Solr
Once the ZooKeeper Service is running, configure each Solr host with the ZooKeeper Quorum address or addresses.
Provide the ZooKeeper Quorum address for each ZooKeeper server. This could be a single address in smaller
deployments, or multiple addresses if you deploy additional servers.
Configure the ZooKeeper Quorum address in solr-env.sh. The file location varies by installation type. If you
accepted default file locations, the solr-env.sh file can be found in:
• Parcels: /opt/cloudera/parcels/CDH-*/etc/default/solr
• Packages: /etc/default/solr
Edit the property to configure the hosts with the address of the ZooKeeper service. You must make this
configuration change for every Solr Server host. The following example shows a configuration with three ZooKeeper
hosts:
SOLR_ZK_ENSEMBLE=<zkhost1>:2181,<zkhost2>:2181,<zkhost3>:2181/solr
SOLR_HDFS_HOME=hdfs://namenodehost:8020/solr
Replace namenodehost with the hostname of your HDFS NameNode (as specified by fs.default.name or
fs.defaultFS in your conf/core-site.xml file). You may also need to change the port number from the
default (8020). On an HA-enabled cluster, ensure that the HDFS URI you use reflects the designated name
service utilized by your cluster. This value should be reflected in fs.default.name; instead of a hostname,
you would see hdfs://nameservice1 or something similar.
2. In some cases, such as for configuring Solr to work with HDFS High Availability (HA), you may want to configure
the Solr HDFS client by setting the HDFS configuration directory in /etc/default/solr or
/opt/cloudera/parcels/CDH-*/etc/default/solr. On every Solr Server host, locate the appropriate
HDFS configuration directory and edit the following property with the absolute path to this directory :
SOLR_HDFS_CONFIG=/etc/hadoop/conf
Replace the path with the correct directory containing the proper HDFS configuration files, core-site.xml
and hdfs-site.xml.
Cloudera Search | 17
Search Installation
For more information, see Create and Deploy the Kerberos Principals and Keytab Files
See Create and Deploy the Kerberos Principals and Keytab Files for information on using kadmin or
kadmin.local).
SOLR_KERBEROS_ENABLED=true
SOLR_KERBEROS_KEYTAB=/etc/solr/conf/solr.keytab
SOLR_KERBEROS_PRINCIPAL=solr/[email protected]
$ solrctl init
Warning: solrctl init takes a --force option as well. solrctl init --force clears the Solr
data in ZooKeeper and interferes with any running hosts. If you clear Solr data from ZooKeeper to
start over, be sure to stop the cluster first.
18 | Cloudera Search
Search Installation
Starting Solr
To start the cluster, start Solr Server on each host:
After you have started the Cloudera Search Server, the Solr server should be running. To verify that all daemons
are running, use the jps tool from the Oracle JDK, which you can obtain from the Java SE Downloads page. If
you are running a pseudo-distributed HDFS installation and a Solr search installation on one machine, jps
shows the following output:
You can customize it by directly editing the solrconfig.xml and schema.xml files created in
$HOME/solr_configs/conf.
These configuration files are compatible with the standard Solr tutorial example documents.
After configuration is complete, you can make it available to Solr by issuing the following command, which
uploads the content of the entire instance directory to ZooKeeper:
Use the solrctl tool to verify that your instance directory uploaded successfully and is available to ZooKeeper.
List the contents of an instance directory as follows:
If you used the earlier --create command to create collection1, the --list command should return
collection1.
Important:
If you are familiar with Apache Solr, you might configure a collection directly in solr home:
/var/lib/solr. Although this is possible, Cloudera recommends using solrctl instead.
Cloudera Search | 19
Search Installation
You should be able to check that the collection is active. For example, for the server myhost.example.com, you
should be able to navigate to
http://myhost.example.com:8983/solr/collection1/select?q=*%3A*&wt=json&indent=true and
verify that the collection is active. Similarly, you should be able to view the topology of your SolrCloud using a
URL similar to http://myhost.example.com:8983/solr/#/~cloud.
4. Verify that the collection is live and that the one shard is served by two hosts. For example, for the server
myhost.example.com, you should receive content from:
http://myhost.example.com:8983/solr/#/~cloud.
For example to create a new replica of collection named collection1 that is comprised of shard1, use the
following command:
Where:
• target_solr_server: The server to host the new shard
• core_name: <collection_name><shard_id><replica_id>
• shard_id: New shard identifier
20 | Cloudera Search
Search Installation
For example, to add a new second shard named shard2 to a solr server named mySolrServer, where the
collection is named myCollection, you would use the following command:
For information on using Spark to batch index documents, see the Spark Indexing Reference (CDH 5.2 or later
only) on page 53.
For information on using MapReduce to batch index documents, see the MapReduce Batch Indexing Reference
on page 58.
Cloudera Search | 21
Search Installation
To accommodate the HBase ingest load, you can run as many Lily HBase Indexer services on different hosts as
required. See the HBase replication documentation for details on how to plan the capacity. You can co-locate
Lily HBase Indexer service processes with SolrCloud on the same set of hosts.
To install the Lily HBase Indexer service on RHEL systems:
To install the Lily HBase Indexer service on Ubuntu and Debian systems:
Important: For the Lily HBase Indexer to work with CDH 5, you may need to run the following command
before issuing Lily HBase MapReduce jobs:
Important: Before upgrading, make backup copies of the following configuration files:
• /etc/default/solr or /opt/cloudera/parcels/CDH-*/etc/default/solr
• All collection configurations
Make sure you copy every host that is part of the SolrCloud.
• To upgrade Search 1.x, see Upgrading to the Latest Search 1.x on page 23.
• If you are running CDH 4 and want to upgrade to Search for CDH 5, see Upgrading Search 1.x to Search for
CDH 5 on page 26.
22 | Cloudera Search
Search Installation
Note: To see which version of Cloudera Manager is recommended with the latest version of Search,
refer to Cloudera Search Requirements on page 10.
You can check which packages are installed using one of the following commands, depending on your operating
system:
Remove the packages using the appropriate remove command for your OS. For example:
Cloudera Search | 23
Search Installation
The contents of Search .repo file should look similar to the following:
[cloudera-search]
# Packages for Cloudera Search version 1.x, on RedHat or CentOS 6 x86_64
name=Cloudera Search version 1.x
baseurl=http://archive.cloudera.com/search/redhat/6/x86_64/search/1/
gpgkey =
http://archive.cloudera.com/search/redhat/6/x86_64/search/RPM-GPG-KEY-cloudera
gpgcheck = 1
• You may also need to update your CDH 4 .repo or .list file. This can be found at
http://archive.cloudera.com/cdh4/. Links to the CDH 4 repositories can be found at CDH 4 Version
and Packaging Information.
Note: Make sure you have only one .repo file for a specific component. If you have a .repo
file for a previous version, you should remove it before you download a new version.
5. Use one of the following sets of commands to update Solr on each host in your cluster where Solr-server is
installed:
24 | Cloudera Search
Search Installation
2. Update the .repo files to point to the latest .repo URLs. Depending on your version of CDH 4, you may need
to upgrade your CDH 4 deployment in addition to your Search version.
• Download the latest search .repo file, cloudera-search.repo, from
http://archive.cloudera.com/search/. You can find links to the latest .repo or .list files at Cloudera
Search Version and Download Information. See the examples above for what the contents of the .repo
files should look like.
• You may also need to update your CDH 4 .repo or .list file. This can be found at
http://archive.cloudera.com/cdh4/. Links to the CDH 4 repos can be found at CDH 4 Version and
Packaging Information.
Note: Make sure you have only one .repo file for a specific component. If you have a .repo file
for a previous version, you should remove it before you download a new version.
3. Use one of the following sets of commands to update Search on each host in your cluster:
4. Restart the Search service. Expect to see a process named solrd if the service started successfully.
Cloudera Search | 25
Search Installation
Note:
If the services did not start successfully (even though the sudo service command might display
[OK]), check for errors in the Search log file, typically in /var/log/solr.
1. Check which packages are installed using one of the following commands, depending on your operating
system:
2. Remove the packages using the appropriate remove command for your OS. For example:
SLES /etc/zypp/repos.d/cloudera-search.repo
26 | Cloudera Search
Search Installation
$ cd /usr/share/hue
$ sudo tar -xzvf hue-search-####.tar.gz
$ sudo /usr/share/hue/tools/app_reg/app_reg.py \
--install /usr/share/hue/apps/search
Cloudera Search | 27
Search Installation
SOLR_SECURITY_ALLOWED_PROXYUSERS=hue
SOLR_SECURITY_PROXYUSER_hue_HOSTS=*
SOLR_SECURITY_PROXYUSER_hue_GROUPS=*
For more information about Secure Impersonation or to set up additional users for Secure Impersonation,
see Enabling Secure Impersonation on page 102.
5. (Optional) To view files in HDFS, ensure that the correct webhdfs_url is included in hue.ini and WebHDFS
is properly configured as described in Configuring CDH Components for Hue.
6. Restart Hue:
$ cd /usr/share/hue
$ sudo tar -xzvf hue-search-####.tar.gz
$ sudo /usr/share/hue/tools/app_reg/app_reg.py \
--install /usr/share/hue/apps/search
2. Restart Hue:
28 | Cloudera Search
Search Installation
For information about new features in the latest release and issues that are fixed or still outstanding, see the
Cloudera Search Release Notes on page 124.
Search 1.3.0
Release Date: May 2014
Cloudera Search 1.3 is supported with CDH 4.7.
Yum RHEL 6/CentOS 6 (64-bit) RHEL 6/CentOS 6 Repo Location RHEL 6/CentOS 6 Repo File
Yum RHEL 5/CentOS 5 (64-bit) RHEL 5/CentOS 5 Repo Location RHEL 5/CentOS 5 Repo File
Apt-Get Ubuntu 10.04 (Lucid) Ubuntu 10.04 List File Location Ubuntu 10.04 List File
(64-bit)
Apt-Get Ubuntu 12.04 ( Precise) Ubuntu 12.04 List File Location Ubuntu 12.04 List File
(64-bit)
Apt-Get Debian (Squeeze) (64-bit) Debian (Squeeze) List File Location Debian (Squeeze) List File
Search 1.2.0
Release Date: February 2014
Cloudera Search 1.2 is supported with CDH 4.6.
Yum RHEL 6/CentOS 6 (64-bit) RHEL 6/CentOS 6 Repo Location RHEL 6/CentOS 6 Repo File
Yum RHEL 5/CentOS 5 (64-bit) RHEL 5/CentOS 5 Repo Location RHEL 5/CentOS 5 Repo File
Apt-Get Ubuntu 10.04 (Lucid) Ubuntu 10.04 List File Location Ubuntu 10.04 List File
(64-bit)
Apt-Get Ubuntu 12.04 ( Precise) Ubuntu 12.04 List File Location Ubuntu 12.04 List File
(64-bit)
Apt-Get Debian (Squeeze) (64-bit) Debian (Squeeze) List File Location Debian (Squeeze) List File
Search 1.1.0
Release Date: November 2013
Cloudera Search 1.1 is supported with CDH 4.5.
Yum RHEL 6/CentOS 6 (64-bit) RHEL 6/CentOS 6 Repo Location RHEL 6/CentOS 6 Repo File
Cloudera Search | 29
Search Installation
Yum RHEL 5/CentOS 5 (64-bit) RHEL 5/CentOS 5 Repo Location RHEL 5/CentOS 5 Repo File
Apt-Get Ubuntu 10.04 (Lucid) Ubuntu 10.04 List File Location Ubuntu 10.04 List File
(64-bit)
Apt-Get Ubuntu 12.04 ( Precise) Ubuntu 12.04 List File Location Ubuntu 12.04 List File
(64-bit)
Apt-Get Debian (Squeeze) (64-bit) Debian (Squeeze) List File Location Debian (Squeeze) List File
Search 1.0.0
Release Date: September 2013
Cloudera Search 1.0.0 is supported with CDH 4.3 and CDH 4.4.
Yum RHEL 6/CentOS 6 (64-bit) RHEL 6/CentOS 6 Repo Location RHEL 6/CentOS 6 Repo File
Yum RHEL 5/CentOS 5 (64-bit) RHEL 5/CentOS 5 Repo Location RHEL 5/CentOS 5 Repo File
Apt-Get Ubuntu 10.04 (Lucid) Ubuntu 10.04 List File Location Ubuntu 10.04 List File
(64-bit)
Apt-Get Ubuntu 12.04 ( Precise) Ubuntu 12.04 List File Location Ubuntu 12.04 List File
(64-bit)
Apt-Get Debian (Squeeze) (64-bit) Debian (Squeeze) List File Location Debian (Squeeze) List File
30 | Cloudera Search
Cloudera Search User Guide
Cloudera Search | 31
Cloudera Search User Guide
• Scalability, flexibility, and reliability of search services on the same platform used to execute other types of
workloads on the same data
The following table describes Cloudera Search features.
Feature Description
Unified management and Cloudera Manager provides unified and centralized management and
monitoring with Cloudera Manager monitoring for CDH and Cloudera Search. Cloudera Manager simplifies
deployment, configuration, and monitoring of your search services. Many
existing search solutions lack management and monitoring capabilities
and fail to provide deep insight into utilization, system health, trending,
and other supportability aspects.
Index storage in HDFS Cloudera Search is integrated with HDFS for index storage. Indexes created
by Solr/Lucene can be directly written in HDFS with the data, instead of
to local disk, thereby providing fault tolerance and redundancy.
Cloudera Search is optimized for fast read and write of indexes in HDFS
while indexes are served and queried through standard Solr mechanisms.
Because data and indexes are co-located, data processing does not require
transport or separately managed storage.
Batch index creation through To facilitate index creation for large data sets, Cloudera Search has built-in
MapReduce MapReduce jobs for indexing data stored in HDFS. As a result, the linear
scalability of MapReduce is applied to the indexing pipeline.
Real-time and scalable indexing at Cloudera Search provides integration with Flume to support near real-time
data ingest indexing. As new events pass through a Flume hierarchy and are written
to HDFS, those events can be written directly to Cloudera Search indexers.
In addition, Flume supports routing events, filtering, and annotation of
data passed to CDH. These features work with Cloudera Search for
improved index sharding, index separation, and document-level access
control.
Easy interaction and data A Cloudera Search GUI is provided as a Hue plug-in, enabling users to
exploration through Hue interactively query data, view result files, and do faceted exploration. Hue
can also schedule standing queries and explore index files. This GUI uses
the Cloudera Search API, which is based on the standard Solr API.
Simplified data processing for Cloudera Search relies on Apache Tika for parsing and preparation of many
Search workloads of the standard file formats for indexing. Additionally, Cloudera Search
supports Avro, Hadoop Sequence, and Snappy file format mappings, as
well as Log file formats, JSON, XML, and HTML. Cloudera Search also
provides data preprocessing using Morphlines, which simplifies index
configuration for these formats. Users can use the configuration for other
applications, such as MapReduce jobs.
HBase search Cloudera Search integrates with HBase, enabling full-text search of stored
data without affecting HBase performance. A listener monitors the
replication event stream and captures each write or update-replicated
event, enabling extraction and mapping. The event is then sent directly
to Solr indexers and written to indexes in HDFS, using the same process
as for other indexing workloads of Cloudera Search. The indexes can be
served immediately, enabling near real-time search of HBase data.
32 | Cloudera Search
Cloudera Search User Guide
Cloudera Search | 33
Cloudera Search User Guide
34 | Cloudera Search
Cloudera Search User Guide
Each Cloudera Search server can handle requests for information. As a result, a client can send requests to index
documents or perform searches to any Search server, and that server routes the request to the correct server.
Ingestion
You can move content to CDH by using:
• Flume, a flexible, agent-based data ingestion framework.
• A copy utility such as distcp for HDFS.
• Sqoop, a structured data ingestion connector.
• fuse-dfs.
Cloudera Search | 35
Cloudera Search User Guide
In a typical environment, administrators establish systems for search. For example, HDFS is established to
provide storage; Flume or distcp are established for content ingestion. After administrators establish these
services, users can use ingestion tools such as file copy utilities or Flume sinks.
Indexing
Content must be indexed before it can be searched. Indexing comprises the following steps:
1. Extraction, transformation, and loading (ETL) - Use existing engines or frameworks such as Apache Tika or
Cloudera Morphlines.
a. Content and metadata extraction
b. Schema mapping
2. Create indexes using Lucene.
a. Index creation
b. Index serialization
Indexes are typically stored on a local file system. Lucene supports additional index writers and readers. One
HDFS-based interface implemented as part of Apache Blur is integrated with Cloudera Search and has been
optimized for CDH-stored indexes. All index data in Cloudera Search is stored in and served from HDFS.
You can index content in three ways:
36 | Cloudera Search
Cloudera Search User Guide
Cloudera Search includes a Flume sink that enables you to write events directly to the indexer. This sink provides
a flexible, scalable, fault-tolerant, near real-time (NRT) system for processing continuous streams of records to
create live-searchable, free-text search indexes. Typically, data ingested using the Flume sink appears in search
results in seconds, although you can tune this duration.
The Flume sink meets the needs of identified use cases that rely on NRT availability. Data can flow from multiple
sources through multiple flume hosts. These hosts, which can be spread across a network, route this information
to one or more Flume indexing sinks. Optionally, you can split the data flow, storing the data in HDFS while
writing it to be indexed by Lucene indexers on the cluster. In that scenario, data exists both as data and as
indexed data in the same storage infrastructure. The indexing sink extracts relevant data, transforms the material,
and loads the results to live Solr search servers. These Solr servers are immediately ready to serve queries to
end users or search applications.
This flexible, customizable system scales effectively because parsing is moved from the Solr server to the multiple
Flume hosts for ingesting new content.
Search includes parsers for standard data formats including Avro, CSV, Text, HTML, XML, PDF, Word, and Excel.
You can extend the system by adding additional custom parsers for other file or data formats in the form of
Tika plug-ins. Any type of data can be indexed: a record is a byte array of any format, and custom ETL logic can
handle any format variation.
In addition, Cloudera Search includes a simplifying ETL framework called Cloudera Morphlines that can help
adapt and pre-process data for indexing. This eliminates the need for specific parser deployments, replacing
them with simple commands.
Cloudera Search is designed to handle a variety of use cases:
• Search supports routing to multiple Solr collections to assign a single set of servers to support multiple user
groups (multi-tenancy).
• Search supports routing to multiple shards to improve scalability and reliability.
• Index servers can be collocated with live Solr servers serving end-user queries, or they can be deployed on
separate commodity hardware, for improved scalability and reliability.
• Indexing load can be spread across a large number of index servers for improved scalability and can be
replicated across multiple index servers for high availability.
This flexible, scalable, highly available system provides low latency data acquisition and low latency querying.
Instead of replacing existing solutions, Search complements use cases based on batch analysis of HDFS data
using MapReduce. In many use cases, data flows from the producer through Flume to both Solr and HDFS. In
this system, you can use NRT ingestion and batch analysis tools.
NRT indexing using some other client that uses the NRT API
Other clients can complete NRT indexing. This is done when the client first writes files directly to HDFS and then
triggers indexing using the Solr REST API. Specifically, the API does the following:
1. Extract content from the document contained in HDFS, where the document is referenced by a URL.
2. Map the content to fields in the search schema.
3. Create or update a Lucene index.
This is useful if you index as part of a larger workflow. For example, you could trigger indexing from an Oozie
workflow.
Querying
After data is available as an index, the query API provided by the search service allows direct queries to be
executed or to be facilitated through a command-line tool or graphical interface. Cloudera Search provides a
simple UI application that can be deployed with Hue, or you can create a custom application based on the standard
Solr API. Any application that works with Solr is compatible and runs as a search-serving application for Cloudera
Search, because Solr is the core.
Cloudera Search | 37
Cloudera Search User Guide
Warning: This tutorial is intended for use in an unsecured environment. In an environment that
requires Kerberos authentication, this tutorial can not be completed without additional configuration.
Note: Validating deployments using the Solr REST API only succeeds if Kerberos is not required. Use
the following processes only if Kerberos is disabled.
Indexing Data
Begin by indexing data to be queried later. Sample data is provided in the installed packages. Replace $SOLRHOST
in the example below with the name of any host running the Solr process.
• Parcel-based Installation:
$ cd /opt/cloudera/parcels/CDH/share/doc/solr-doc*/example/exampledocs
$ java -Durl=http://$SOLRHOST:8983/solr/collection1/update -jar post.jar *.xml
38 | Cloudera Search
Cloudera Search User Guide
• Package-based Installation:
$ cd /usr/share/doc/solr-doc*/example/exampledocs
$ java -Durl=http://$SOLRHOST:8983/solr/collection1/update -jar post.jar *.xml
Running Queries
After you have indexed data, you can run a query.
To run a query:
1. Open the following link in a browser, replacing $SOLRHOST with the name of any host running the Solr process:
http://$SOLRHOST:8983/solr.
2. Click the collection name in the left panel.
3. Click Query in the Menu and select execute query.
Note: Choose wt as json and select the indent option in the web GUI to see more readable output.
Next Steps
Consider indexing more data using the Solr REST API, or move to batch indexing with MapReduce or NRT indexing
with Flume. To learn more about Solr, see the Apache Solr Tutorial.
• Package-based Installation:
5. Verify the collection is live. For example, for the localhost, use http://localhost:8983/solr/#/~cloud.
6. Prepare the configuration for use with MapReduce:
$ cp -r $HOME/solr_configs2 $HOME/collection2
Cloudera Search | 39
Cloudera Search User Guide
7. Locate input files suitable for indexing, and check that the directory exists. This example assumes you are
running the following commands as $USER with access to HDFS.
• Parcel-based Installation:
• Package-based Installation:
9. Collect HDFS/MapReduce configuration details by downloading them from Cloudera Manager or using
/etc/hadoop, depending on your installation mechanism for the Hadoop cluster. This example uses the
configuration in /etc/hadoop/conf.cloudera.mapreduce1. Substitute the correct Hadoop configuration
path for your cluster.
2. Run the MapReduce job using GoLive. Replace $NNHOST and $ZKHOST in the command with your NameNode
and ZooKeeper host names and port numbers, as required. You do not need to specify --solr-home-dir
because the job accesses it from ZooKeeper.
40 | Cloudera Search
Cloudera Search User Guide
• Parcel-based Installation:
• Package-based Installation:
Note: This command requires a morphline file, which must include a SOLR_LOCATOR. Any CLI
parameters for --zkhost and --collection override the parameters of the solrLocator. The
snippet that includes the SOLR_LOCATOR might appear as follows:
SOLR_LOCATOR : {
# Name of solr collection
collection : collection
# ZooKeeper ensemble
zkHost : "$ZK_HOST"
}
morphlines : [
{
id : morphline1
importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
commands : [
{ generateUUID { field : id } }
{ # Remove record fields that are unknown to Solr schema.xml.
# Recall that Solr throws an exception on any attempt to load a
document that
# contains a field that isn't specified in schema.xml.
sanitizeUnknownSolrFields {
solrLocator : ${SOLR_LOCATOR} # Location from which to fetch Solr
schema
}
}
{
loadSolr {
solrLocator : ${SOLR_LOCATOR}
}
}
]
}
]
Cloudera Search | 41
Cloudera Search User Guide
4. When the job is complete, run some Solr queries. For example, for myserver.example.com, use:
http://myserver.example.com:8983/solr/collection2/select?q=*%3A*&wt=json&indent=true
For help on how to run a Hadoop MapReduce job, use the following command:
• Parcel-based Installation:
• Package-based Installation:
Note:
• For development purposes, use the MapReduceIndexerTool --dry-run option to run in local
mode and print documents to stdout, instead of loading them to Solr. Using this option causes
the morphline to execute in the client process without submitting a job to MapReduce. Executing
in the client process provides faster turnaround during early trial and debug sessions.
• To print diagnostic information, such as the content of records as they pass through the
morphline commands, enable TRACE log level diagnostics by adding the following entry to your
log4j.properties file:
log4j.logger.com.cloudera.cdk.morphline=TRACE
2. Run the Hadoop MapReduce job, replacing $NNHOST in the command with your NameNode hostname and
port number, as required.
• Parcel-based Installation:
42 | Cloudera Search
Cloudera Search User Guide
• Package-based Installation:
3. Check the job tracker status. For example, for the localhost, use http://localhost:50030/jobtracker.jsp.
4. After the job is completed, check the generated index files. Individual shards are written to the results directory
with names of the form part-00000, part-00001, part-00002. There are only two shards in this example.
6. List the host name folders used as part of the path to each index in the SolrCloud cluster.
c. Move the two index shards into place (the two servers you set up in Preparing to Index Data on page 39):
Near Real Time (NRT) Indexing Using Flume and the Solr Sink
The following section describes how to use Flume to index tweets. Before beginning, complete the process of
Preparing to Index Data.
Cloudera Search | 43
Cloudera Search User Guide
• Package-based Installation:
agent.sinks.solrSink.morphlineFile =
/opt/cloudera/parcels/CDH/etc/flume-ng/conf/morphline.conf
• Package-based Installation:/etc/flume-ng/conf/flume.conf:
agent.sinks.solrSink.morphlineFile = /etc/flume-ng/conf/morphline.conf
2. Edit /etc/flume-ng/conf/morphline.conf or
/opt/cloudera/parcels/CDH/etc/flume-ng/conf/morphline.conf to specify the Solr location details
using a SOLR_LOCATOR. The snippet that includes the SOLR_LOCATOR might appear as follows:
SOLR_LOCATOR : {
# Name of solr collection
collection : collection
# ZooKeeper ensemble
zkHost : "$ZK_HOST"
}
morphlines : [
{
id : morphline1
importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
commands : [
{ generateUUID { field : id } }
44 | Cloudera Search
Cloudera Search User Guide
}
}
{
loadSolr {
solrLocator : ${SOLR_LOCATOR}
}
}
]
}
]
$ sudo cp /opt/cloudera/parcels/CDH/etc/flume-ng/conf/flume-env.sh.template \
/etc/flume-ng/conf/flume-env.sh
• Package-based Installation:
$ sudo cp /etc/flume-ng/conf/flume-env.sh.template \
/etc/flume-ng/conf/flume-env.sh
4. Edit /etc/flume-ng/conf/flume-env.sh or
/opt/cloudera/parcels/CDH/etc/flume-ng/conf/flume-env.sh, inserting or replacing JAVA_OPTS as
follows:
JAVA_OPTS="-Xmx500m"
6. (Optional) You can configure the location at which Flume finds Cloudera Search dependencies for Flume Solr
Sink using SEARCH_HOME. For example, if you installed Flume from a tarball package, you can configure it to
find required files by setting SEARCH_HOME. To set SEARCH_HOME use a command of the form:
• Parcel-based Installation:
$ export SEARCH_HOME=/opt/cloudera/parcels/CDH/lib/search
• Package-based Installation:
$ export SEARCH_HOME=/usr/lib/search
Cloudera Search | 45
Cloudera Search User Guide
agent.sources.twitterSrc.consumerKey = YOUR_TWITTER_CONSUMER_KEY
agent.sources.twitterSrc.consumerSecret = YOUR_TWITTER_CONSUMER_SECRET
agent.sources.twitterSrc.accessToken = YOUR_TWITTER_ACCESS_TOKEN
agent.sources.twitterSrc.accessTokenSecret = YOUR_TWITTER_ACCESS_TOKEN_SECRET
Use the Twitter developer site to generate these four codes by completing the following steps:
1. Sign in to https://dev.twitter.com with a Twitter account.
2. Select My applications from the drop-down menu in the top-right corner, and Create a new application.
3. Fill in the form to represent the Search installation. This can represent multiple clusters, and does not require
the callback URL. Because this is not a publicly distributed application, the values you enter for the required
name, description, and website fields are not important.
4. Click Create my access token at the bottom of the page. You may have to refresh the page to see the access
token.
Substitute the consumer key, consumer secret, access token, and access token secret into flume.conf. Consider
this information confidential, just like your regular Twitter credentials.
To enable authentication, ensure the system clock is set correctly on all hosts where Flume connects to Twitter.
You can install NTP and keep the host synchronized by running the ntpd service, or manually synchronize using
the command sudo ntpdate pool.ntp.org . To confirm that the time is set correctly, make sure that the
output of the command date --utc matches the time shown at
http://www.timeanddate.com/worldclock/timezone/utc. You can also set the time manually using the date
command.
3. Use the start or restart functions. For example, to restart a running Flume Agent:
4. Monitor progress in the Flume log file and watch for errors:
$ tail -f /var/log/flume-ng/flume.log
After restarting the Flume agent, use the Cloudera Search GUI. For example, for the localhost, use
http://localhost:8983/solr/collection2/select?q=*%3A*&sort=created_at+desc&wt=json&indent=true
to verify that new tweets have been ingested into Solr. The query sorts the result set such that the most recently
ingested tweets are at the top, based on the created_at timestamp. If you rerun the query, new tweets show
up at the top of the result set.
To print diagnostic information, such as the content of records as they pass through the morphline commands,
enable TRACE log level diagnostics by adding the following to your log4j.properties file:
log4j.logger.com.cloudera.cdk.morphline=TRACE
46 | Cloudera Search
Cloudera Search User Guide
In Cloudera Manager, you can use the safety valve to enable TRACE log level.
Navigate to Menu Services > Flume > Configuration > View and Edit > Agent > Advanced > Agent Logging Safety
Valve. After setting this value, restart the service.
$ curl --data-binary \
@/opt/cloudera/parcels/CDH/share/doc/search-*/examples/test-documents/sample-statuses-20120906-141433-medium.avro
\
'http://127.0.0.1:5140?resourceName=sample-statuses-20120906-141433-medium.avro'
\
--header 'Content-Type:application/octet-stream' --verbose
• Package-based Installation:
$ curl --data-binary \
@/usr/share/doc/search-*/examples/test-documents/sample-statuses-20120906-141433-medium.avro
\
'http://127.0.0.1:5140?resourceName=sample-statuses-20120906-141433-medium.avro'
\
--header 'Content-Type:application/octet-stream' --verbose
$ cat /var/log/flume-ng/flume.log
Cloudera Search | 47
Cloudera Search User Guide
3. Delete any old spool directory and create a new spool directory:
$ rm -fr /tmp/myspooldir
$ sudo -u flume mkdir /tmp/myspooldir
5. Send a file containing tweets to the SpoolDirectorySource. To ensure no partial files are ingested, copy
and then atomically move files:
• Parcel-based Installation:
$ sudo -u flume cp \
/opt/cloudera/parcels/CDH/share/doc/search*/examples/test-documents/sample-statuses-20120906-141433-medium.avro
\
/tmp/myspooldir/.sample-statuses-20120906-141433-medium.avro
$ sudo -u flume mv /tmp/myspooldir/.sample-statuses-20120906-141433-medium.avro
\
/tmp/myspooldir/sample-statuses-20120906-141433-medium.avro
• Package-based Installation:
$ sudo -u flume cp \
/usr/share/doc/search*/examples/test-documents/sample-statuses-20120906-141433-medium.avro
\
/tmp/myspooldir/.sample-statuses-20120906-141433-medium.avro
$ sudo -u flume mv /tmp/myspooldir/.sample-statuses-20120906-141433-medium.avro
\
/tmp/myspooldir/sample-statuses-20120906-141433-medium.avro
$ cat /var/log/flume-ng/flume.log
$ find /tmp/myspooldir
Use the Cloudera Search GUI. For example, for the localhost, use
http://localhost:8983/solr/collection2/select?q=*%3A*&wt=json&indent=true to verify that new
tweets have been ingested into Solr.
48 | Cloudera Search
Cloudera Search User Guide
You can watch a recording of the Hue Search Twitter Demo at Tutorial: Search Hadoop in Hue 2.4.
Importing Collections
The following figure shows the collection import feature in Hue.
Generally, only collections should be imported. Importing cores is rarely useful because it enables querying a
shard of the index. See A little about SolrCores and Collections for more information.
Customization UI
The following figure shows the Search customization interface provided in Hue.
Cloudera Search | 49
Cloudera Search User Guide
Solrctl Reference
Use the solrctl utility to manage a SolrCloud deployment. You can manipulate SolrCloud collections, SolrCloud
collection instance directories, and individual cores.
A SolrCloud collection is the top-level object for indexing documents and providing a query interface. Each
SolrCloud collection must be associated with an instance directory, though note that different collections can
use the same instance directory. Each SolrCloud collection is typically replicated (sharded) among several SolrCloud
instances. Each replica is called a SolrCloud core and is assigned to an individual SolrCloud host. The assignment
process is managed automatically, although you can apply fine-grained control over each individual core using
the core command. A typical deployment workflow with solrctl consists of:
• Deploying the ZooKeeper coordination service
• Deploying solr-server daemons to each host
• Initializing the state of the ZooKeeper coordination service using init command
• Starting each solr-server daemon
• Generating an instance directory
• Uploading the instance directory to ZooKeeper
• Associating a new collection with the name of the instance directory.
In general, if an operation succeeds, solrctl exits silently with a success exit code. If an error occurs, solrctl
prints a diagnostics message combined with a failure exit code.
You can execute solrctl on any host that is configured as part of the SolrCloud. To execute any solrctl
command on a host outside of SolrCloud deployment, ensure that SolrCloud hosts are reachable and provide
--zk and --solr command line options.
50 | Cloudera Search
Cloudera Search User Guide
If you are using solrctl to manage your deployment in an environment that requires Kerberos authentication,
you must have a valid Kerberos ticket, which you can get using kinit.
You can see examples of using solrctl in Deploying Cloudera Search on page 16.
$ export NO_PROXY='*'
• Modify the settings for single commands by prefacing solrctl commands with NO_PROXY='*'. For example:
Syntax
You can initialize the state of the entire SolrCloud deployment and each individual host within the SolrCloud
deployment by using solrctl. The general solrctl command syntax is:
solrctl [options] command [command-arg] [command [command-arg]] ...
Each element and its possible values are described in the following sections.
Options
If used, the following options must precede commands:
• --solr solr_uri: Directs solrctl to a SolrCloud web API available at a given URI. This option is required
for hosts running outside of SolrCloud. A sample URI might be: http://host1.cluster.com:8983/solr.
• --zk zk_ensemble: Directs solrctl to a particular ZooKeeper coordination service ensemble. This option
is required for hosts running outside of SolrCloud. For example:
host1.cluster.com:2181,host2.cluster.com:2181/solr.
• --jaas jaas.conf: Used to identify a JAAS configuration that specifies the principal with permissions to
modify solr metadata. The principal is typically "solr". In a Kerberos-enabled environment where solr metadata
is protected using ZooKeeper ACLs, modifying metadata using solrctl requires this parameter.
• --help: Prints help.
• --quiet: Suppresses most solrctl messages.
Commands
The solrctl commands init, instancedir, collection, core, and cluster affect the entire SolrCloud
deployment and are executed only once per required operation.
The solrctl core command affects a single SolrCloud host.
• init [--force]: The init command, which initializes the overall state of the SolrCloud deployment, must
be executed before starting solr-server daemons for the first time. Use this command cautiously because
it erases all SolrCloud deployment state information. After successful initialization, you cannot recover any
previous state.
• instancedir [--generate path [-schemaless]] [--create name path] [--update name path]
[--get name path] [--delete name] [--list]: Manipulates the instance directories. The following
options are supported:
Cloudera Search | 51
Cloudera Search User Guide
– --generate path: Allows users to generate the template of the instance directory. The template is
stored at a designated path in a local filesystem and has configuration files under /conf. See Solr's
README.txt for the complete layout.
– -schemaless A schemaless template of the instance directory is generated. For more information
on schemaless support, see Using Schemaless Mode (CDH 5.1 or later only) on page 93.
– --create name path: Pushes a copy of the instance directory from the local filesystem to SolrCloud. If
an instance directory is already available to SolrCloud, this command fails. See --update for changing
name paths that already exist.
– --update name path: Updates an existing SolrCloud copy of an instance directory based on the files in
a local filesystem. This command is analogous to first using --delete name followed by --create name
path.
– --get name path: Downloads the named collection instance directory at a specified path in a local
filesystem. Once downloaded, files can be further edited.
– --delete name: Deletes the instance directory name from SolrCloud.
– --list: Prints a list of all available instance directories known to SolrCloud.
• collection [--create name -s <numShards> [-c <collection.configName>] [-r
<replicationFactor>] [-m <maxShardsPerHost>] [-n <createHostSet>]] [--delete name]
[--reload name] [--stat name] [--list] [--deletedocs name]: Manipulates collections. The
following options are supported:
– --create name -s <numShards> [-a] [-c <collection.configName>] [-r
<replicationFactor>] [-m <maxShardsPerHost>] [-n <createHostSet>]]: Creates a new
collection.
New collections are given the specified name, and are sharded to <numShards>.
The -a option configures auto-addition of replicas if machines hosting existing shards become unavailable.
SolrCloud hosts are configured using the <collection.configName> instance directory. Replication is
configured by a factor of <replicationFactor>. The maximum shards per host is determined by
<maxShardsPerHost>, and the collection is allocated to the hosts specified in <createHostSet>.
The only required parameters are name and numShards. If collection.configName is not provided, it
is assumed to be the same as the name of the collection.
– --delete name: Deletes a collection.
– --reload name: Reloads a collection.
– --stat name: Outputs SolrCloud specific run-time information for a collection.
– --list: Lists all collections registered in SolrCloud.
– --deletedocs name: Purges all indexed documents from a collection.
• core [--create name [-p name=value]...] [--reload name] [--unload name] [--status name]:
Manipulates cores. This is one of two commands that you can execute on a particular SolrCloud host.
52 | Cloudera Search
Cloudera Search User Guide
Note: This command requires a morphline file, which must include a SOLR_LOCATOR. The snippet
that includes the SOLR_LOCATOR might appear as follows:
SOLR_LOCATOR : {
# Name of solr collection
collection : collection
# ZooKeeper ensemble
zkHost : "$ZK_HOST"
}
morphlines : [
{
id : morphline1
importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
commands : [
{ generateUUID { field : id } }
{
loadSolr {
solrLocator : ${SOLR_LOCATOR}
}
}
]
}
]
More details are available through command-line help. The CrunchIndexerTool jar does not contain all
dependencies, unlike other Search indexing tools. Therefore, it is helpful to capture dependencies to variables
that are used in invoking the help.
• To assign dependency information to variables and invoke help in a default parcels installation, use:
$ export myDriverJarDir=/opt/cloudera/parcels/CDH/lib/solr/contrib/crunch
$ export myDependencyJarDir=/opt/cloudera/parcels/CDH/lib/search/lib/search-crunch
$ export myDependencyJarPaths=$(find $myDependencyJarDir -name '*.jar' | sort |
tr '\n' ':' | head -c -1)
$ export myDriverJar=$(find $myDriverJarDir maxdepth 1 -name 'search-crunch.jar'
! -name '-job.jar' ! -name '*-sources.jar')
$ export HADOOP_CLASSPATH=$myDependencyJarPaths;
$ hadoop jar $myDriverJar org.apache.solr.crunch.CrunchIndexerTool -help
Cloudera Search | 53
Cloudera Search User Guide
• To assign dependency information to variables and invoke help in a default packages installation, use:
$ export myDriverJarDir=/usr/lib/solr/contrib/crunch
$ export myDependencyJarDir=/usr/lib/search/lib/search-crunch
$ export myDependencyJarPaths=$(find $myDependencyJarDir -name '*.jar' | sort |
tr '\n' ':' | head -c -1)
$ export myDriverJar=$(find $myDriverJarDir maxdepth 1 -name 'search-crunch.jar'
! -name '-job.jar' ! -name '*-sources.jar')
$ export HADOOP_CLASSPATH=$myDependencyJarPaths;
$ hadoop jar $myDriverJar org.apache.solr.crunch.CrunchIndexerTool -help
Spark or MapReduce ETL batch job that pipes data from (splittable or non-
splittable) HDFS files into Apache Solr, and along the way runs the data
through a Morphline for extraction and transformation. The program is
designed for flexible, scalable and fault-tolerant batch ETL pipeline
jobs. It is implemented as an Apache Crunch pipeline and as such can run
on either the Apache Hadoop MapReduce or Apache Spark execution engine.
Fault Tolerance: Task attempts are retried on failure per the standard
MapReduce or Spark semantics. If the whole job fails you can retry simply
54 | Cloudera Search
Cloudera Search User Guide
1) CrunchIndexerTool can also run on the Spark execution engine, not just
on MapReduce.
2) CrunchIndexerTool enables interactive low latency prototyping, in
particular in Spark 'local' mode.
3) CrunchIndexerTool supports updates (and deletes) of existing documents
in Solr, not just inserts.
4) CrunchIndexerTool can exploit data locality for splittable Hadoop files
(text, avro, avroParquet).
We recommend MapReduceIndexerTool for large scale batch ingestion use
cases where updates (or deletes) of existing documents in Solr are not
required, and we recommend CrunchIndexerTool for all other use cases.
CrunchIndexerOptions:
HDFS_URI HDFS URI of file or directory tree to ingest.
(default: [])
--input-file-list URI, --input-list URI
Local URI or HDFS URI of a UTF-8 encoded file
containing a list of HDFS URIs to ingest, one URI
per line in the file. If '-' is specified, URIs
are read from the standard input. Multiple --
input-file-list arguments can be specified.
--input-file-format FQCN
The Hadoop FileInputFormat to use for extracting
data from splittable HDFS files. Can be a fully
qualified Java class name or one of ['text',
'avro', 'avroParquet']. If this option is present
the extraction phase will emit a series of input
data records rather than a series of HDFS file
input streams.
--input-file-projection-schema FILE
Relative or absolute path to an Avro schema file
on the local file system. This will be used as
the projection schema for Parquet input files.
--input-file-reader-schema FILE
Relative or absolute path to an Avro schema file
on the local file system. This will be used as
the reader schema for Avro or Parquet input
files. Example: src/test/resources/test-
documents/strings.avsc
--morphline-file FILE Relative or absolute path to a local config file
that contains one or more morphlines. The file
must be UTF-8 encoded. It will be uploaded to
each remote task. Example: /path/to/morphline.conf
--morphline-id STRING The identifier of the morphline that shall be
executed within the morphline config file
specified by --morphline-file. If the --morphline-
id option is omitted the first (i.e. top-most)
morphline within the config file is used.
Example: morphline1
--pipeline-type STRING
The engine to use for executing the job. Can be
'mapreduce' or 'spark'. (default: mapreduce)
--xhelp, --help, -help
Show this help message and exit
--mappers INTEGER Tuning knob that indicates the maximum number of
MR mapper tasks to use. -1 indicates use all map
slots available on the cluster. This parameter
only applies to non-splittable input files
(default: -1)
--dry-run Run the pipeline but print documents to stdout
instead of loading them into Solr. This can be
used for quicker turnaround during early trial &
debug sessions. (default: false)
--log4j FILE Relative or absolute path to a log4j.properties
config file on the local file system. This file
will be uploaded to each remote task. Example:
/path/to/log4j.properties
--chatty Turn on verbose output. (default: false)
Cloudera Search | 55
Cloudera Search User Guide
Examples:
56 | Cloudera Search
Cloudera Search User Guide
--conf "spark.executor.extraJavaOptions=$myJVMOptions" \
--driver-java-options "$myJVMOptions" \
# --driver-library-path /opt/cloudera/parcels/CDH/lib/hadoop/lib/native \
# for Snappy on CDH with parcels\
# --driver-library-path /usr/lib/hadoop/lib/native \
# for Snappy on CDH with packages \
--class org.apache.solr.crunch.CrunchIndexerTool \
$myDriverJar \
-D morphlineVariable.ZK_HOST=$(hostname):2181/solr \
--morphline-file $myResourcesDir/test-morphlines/loadSolrLine.conf \
--pipeline-type spark \
--chatty \
--log4j $myResourcesDir/log4j.properties \
/user/systest/input/hello1.txt
# Spark on Yarn in Cluster Mode (for production) - Ingest into Secure (Kerberos-enabled)
Solr:
# Spark requires two additional steps compared to non-secure solr:
# (NOTE: MapReduce does not require extra steps for communicating with kerberos-enabled
Solr)
# 1) Create a delegation token file
# a) kinit as the user who will make solr requests
# b) request a delegation token from solr and save it to a file:
# e.g. using curl:
# "curl --negotiate -u: http://solr-host:port/solr/?op=GETDELEGATIONTOKEN >
tokenFile.txt"
# 2) Pass the delegation token file to spark-submit:
# a) add the delegation token file via --files
# b) pass the file name via -D tokenFile
# spark places this file in the cwd of the executor, so only list the file name,
no path
spark-submit \
--master yarn \
--deploy-mode cluster \
--jars $myDependencyJarFiles \
--executor-memory 500M \
--conf "spark.executor.extraJavaOptions=$myJVMOptions" \
--driver-java-options "$myJVMOptions" \
--class org.apache.solr.crunch.CrunchIndexerTool \
--files $(ls $myResourcesDir/log4j.properties),$(ls
$myResourcesDir/test-morphlines/loadSolrLine.conf),tokenFile.txt\
$myDriverJar \
-D hadoop.tmp.dir=/tmp \
-D morphlineVariable.ZK_HOST=$(hostname):2181/solr \
-DtokenFile=tokenFile.txt \
--morphline-file loadSolrLine.conf \
--pipeline-type spark \
Cloudera Search | 57
Cloudera Search User Guide
--chatty \
--log4j log4j.properties \
/user/systest/input/hello1.txt
MapReduceIndexerTool
MapReduceIndexerTool is a MapReduce batch job driver that takes a morphline and creates a set of Solr index
shards from a set of input files and writes the indexes into HDFS in a flexible, scalable, and fault-tolerant manner.
For more information on Morphlines, see:
• Extracting, Transforming, and Loading Data With Cloudera Morphlines on page 71 for an introduction to
Morphlines.
• Example Morphline Usage on page 73 for morphline examples, discussion of those examples, and links to
additional information.
MapReduceIndexerTool also supports merging the output shards into a set of live customer-facing Solr servers,
typically a SolrCloud.
Note: Merging output shards into live customer-facing Solr servers can only be completed if all
replicas are online.
MapReduce batch job driver that takes a morphline and creates a set of
58 | Cloudera Search
Cloudera Search User Guide
Solr index shards from a set of input files and writes the indexes into
HDFS, in a flexible, scalable and fault-tolerant manner. It also supports
merging the output shards into a set of live customer facing Solr
servers, typically a SolrCloud. The program proceeds in several
consecutive MapReduce based phases, as follows:
2) Mapper phase: This (parallel) phase takes the input files, extracts
the relevant content, transforms it and hands SolrInputDocuments to a set
of reducers. The ETL functionality is flexible and customizable using
chains of arbitrary morphline commands that pipe records from one
transformation command to another. Commands to parse and transform a set
of standard data formats such as Avro, CSV, Text, HTML, XML, PDF, Word,
Excel, etc. are provided out of the box, and additional custom commands
and parsers for additional file or data formats can be added as morphline
plugins. This is done by implementing a simple Java interface that
consumes a record (e.g. a file in the form of an InputStream plus some
headers plus contextual metadata) and generates as output zero or more
records. Any kind of data format can be indexed and any Solr documents
for any kind of Solr schema can be generated, and any custom ETL logic
can be registered and executed.
Record fields, including MIME types, can also explicitly be passed by
force from the CLI to the morphline, for example: hadoop ... -D
morphlineField._attachment_mimetype=text/csv
5) Go-live phase: This optional (parallel) phase merges the output shards
of the previous phase into a set of live customer facing Solr servers,
typically a SolrCloud. If this phase is omitted you can explicitly point
each Solr server to one of the HDFS output shard directories.
Fault Tolerance: Mapper and reducer task attempts are retried on failure
per the standard MapReduce semantics. On program startup all data in the
--output-dir is deleted if that output directory already exists. If the
whole job fails you can retry simply by rerunning the program again using
the same arguments.
positional arguments:
HDFS_URI HDFS URI of file or directory tree to index.
(default: [])
optional arguments:
--help, -help, -h Show this help message and exit
--input-list URI Local URI or HDFS URI of a UTF-8 encoded file
containing a list of HDFS URIs to index, one URI
per line in the file. If '-' is specified, URIs
are read from the standard input. Multiple --
input-list arguments can be specified.
--morphline-id STRING The identifier of the morphline that shall be
executed within the morphline config file
specified by --morphline-file. If the --
morphline-id option is ommitted the first (i.e.
top-most) morphline within the config file is
used. Example: morphline1
--solr-home-dir DIR Optional relative or absolute path to a local
dir containing Solr conf/ dir and in particular
conf/solrconfig.xml and optionally also lib/
dir. This directory will be uploaded to each MR
task. Example: src/test/resources/solr/minimr
--update-conflict-resolver FQCN
Fully qualified class name of a Java class that
Cloudera Search | 59
Cloudera Search User Guide
60 | Cloudera Search
Cloudera Search User Guide
Required arguments:
--output-dir HDFS_URI HDFS directory to write Solr indexes to. Inside
there one output directory per shard will be
generated. Example: hdfs://c2202.mycompany.
com/user/$USER/test
--morphline-file FILE Relative or absolute path to a local config file
that contains one or more morphlines. The file
must be UTF-8 encoded. Example:
/path/to/morphline.conf
Cluster arguments:
Arguments that provide information about your Solr cluster.
Go live arguments:
Cloudera Search | 61
Cloudera Search User Guide
Arguments for merging the shards that are built into a live Solr
cluster. Also see the Cluster arguments.
Examples:
62 | Cloudera Search
Cloudera Search User Guide
--output-dir hdfs://c2202.mycompany.com/user/$USER/test \
--shards 100 \
--input-list -
MapReduceIndexerTool Metadata
The MapReduceIndexerTool generates metadata fields for each input file when indexing. These fields can be
used in morphline commands. These fields can also be stored in Solr, by adding definitions like the following to
Cloudera Search | 63
Cloudera Search User Guide
your Solr schema.xml file. After the MapReduce indexing process completes, the fields are searchable through
Solr.
Example output:
"file_upload_url":"foo/test-documents/sample-statuses-20120906-141433.avro",
"file_download_url":"hdfs://host1.mycompany.com:8020/user/foo/
test-documents/sample-statuses-20120906-141433.avro",
"file_scheme":"hdfs",
"file_host":"host1.mycompany.com",
"file_port":8020,
"file_name":"sample-statuses-20120906-141433.avro",
"file_path":"/user/foo/test-documents/sample-statuses-20120906-141433.avro",
"file_last_modified":1357193447106,
"file_length":1512,
"file_owner":"foo",
"file_group":"foo",
"file_permissions_user":"rw-",
"file_permissions_group":"r--",
"file_permissions_other":"r--",
"file_permissions_stickybit":false,
HdfsFindTool
HdfsFindTool is essentially the HDFS version of the Linux file system find command. The command walks one
or more HDFS directory trees, finds all HDFS files that match the specified expression, and applies selected
actions to them. By default, it prints the list of matching HDFS file paths to stdout, one path per line. The output
file list can be piped into the MapReduceIndexerTool using the MapReduceIndexerTool --inputlist option.
More details are available through command-line help. The command used to invoke the help varies by installation
type and may vary further in custom installations.
• To invoke the command-line help in a default parcels installation, use:
64 | Cloudera Search
Cloudera Search User Guide
-find <path> ... <expression> ...: Finds all files that match the specified expression
and applies selected actions to them.
-blocks n
Evaluates to true if the number of file blocks is n.
-depth
Always evaluates to true. Causes directory contents to be
evaluated before the directory itself.
-empty
Evaluates as true if the file is empty or directory has no
contents.
-group groupname
Evaluates as true if the file belongs to the specified
group.
-mtime n
-mmin n
Evaluates as true if the file modification time subtracted
from the start time is n days (or minutes if -mmin is used)
-name pattern
-iname pattern
Evaluates as true if the basename of the file matches the
pattern using standard file system globbing.
If -iname is used then the match is case insensitive.
-newer file
Evaluates as true if the modification time of the current
file is more recent than the modification time of the
specified file.
-nogroup
Evaluates as true if the file does not have a valid group.
-nouser
Evaluates as true if the file does not have a valid owner.
-perm [-]mode
-perm [-]onum
Evaluates as true if the file permissions match that
specified. If the hyphen is specified then the expression
shall evaluate as true if at least the bits specified
match, otherwise an exact match is required.
The mode may be specified using either symbolic notation,
eg 'u=rwx,g+x+w' or as an octal number.
Cloudera Search | 65
Cloudera Search User Guide
-print
-print0
Always evaluates to true. Causes the current pathname to be
written to standard output. If the -print0 expression is
used then an ASCII NULL character is appended.
-prune
Always evaluates to true. Causes the find command to not
descend any further down this directory tree. Does not
have any affect if the -depth expression is specified.
-replicas n
Evaluates to true if the number of file replicas is n.
-size n[c]
Evaluates to true if the file size in 512 byte blocks is n.
If n is followed by the character 'c' then the size is in bytes.
-type filetype
Evaluates to true if the file type matches that specified.
The following file type values are supported:
'd' (directory), 'l' (symbolic link), 'f' (regular file).
-user username
Evaluates as true if the owner of the file matches the
specified user.
! expression
-not expression
Evaluates as true if the expression evaluates as false and
vice-versa.
expression -o expression
expression -or expression
Logical OR operator for joining two expressions. Returns
true if one of the child expressions returns true. The
second expression will not be applied if the first returns
true.
-help [cmd ...]: Displays help for given command or all commands if none
is specified.
-usage [cmd ...]: Displays the usage for given command or all commands if none
is specified.
66 | Cloudera Search
Cloudera Search User Guide
Cloudera Search | 67
Cloudera Search User Guide
This example shows a flume.conf section for a SolrSink for the agent named agent:
agent.sinks.solrSink.type = org.apache.flume.sink.solr.morphline.MorphlineSolrSink
agent.sinks.solrSink.channel = memoryChannel
agent.sinks.solrSink.batchSize = 100
agent.sinks.solrSink.batchDurationMillis = 1000
agent.sinks.solrSink.morphlineFile = /etc/flume-ng/conf/morphline.conf
agent.sinks.solrSink.morphlineId = morphline1
Note: The examples in this document use a Flume MemoryChannel to easily get started. For production
use it is often more appropriate to configure a Flume FileChannel instead, which is a high performance
transactional persistent queue.
68 | Cloudera Search
Cloudera Search User Guide
Flume supports multiplexing the event flow to destinations by defining a flow multiplexer that can replicate or
selectively route an event to channels. This example shows a source from agent “foo” fanning out the flow to
three different channels. This fan out can be replicating or multiplexing. In replicating, each event is sent to all
three channels. In multiplexing, an event is delivered to a subset of available channels when that event's attribute
matches a preconfigured value. For example, if an event attribute called stream.type is set to application/pdf,
it goes to channel1 and channel3. If the attribute is set to avro/binary, it goes to channel2. If that channel
is unavailable then an exception is thrown and the event is replayed later when the channel becomes available
again. You can set the mapping in the flume.conf file.
Flume MorphlineInterceptor provides the following configuration options in the flume.conf file:
morphlineId null The name used to identify a morphline if a config file has multiple
morphlines.
This example shows a flume.conf section for a MorphlineInterceptor for the agent named "agent":
agent.sources.avroSrc.interceptors = morphlineinterceptor
agent.sources.avroSrc.interceptors.morphlineinterceptor.type =
org.apache.flume.sink.solr.morphline.MorphlineInterceptor$Builder
agent.sources.avroSrc.interceptors.morphlineinterceptor.morphlineFile =
/etc/flume-ng/conf/morphline.conf
agent.sources.avroSrc.interceptors.morphlineinterceptor.morphlineId = morphline1
Note: A morphline interceptor cannot generate more than one output record for each input event.
Cloudera Search | 69
Cloudera Search User Guide
preserveExisting true If the UUID header already exists, determine whether it is preserved.
prefix "" The prefix string constant to prepend to each generated UUID.
This example shows a flume.conf section for a HTTPSource with a BlobHandler for the agent named agent:
agent.sources.httpSrc.type = org.apache.flume.source.http.HTTPSource
agent.sources.httpSrc.port = 5140
agent.sources.httpSrc.handler = org.apache.flume.sink.solr.morphline.BlobHandler
agent.sources.httpSrc.handler.maxBlobLength = 2000000000
agent.sources.httpSrc.interceptors = uuidinterceptor
agent.sources.httpSrc.interceptors.uuidinterceptor.type =
org.apache.flume.sink.solr.morphline.UUIDInterceptor$Builder
agent.sources.httpSrc.interceptors.uuidinterceptor.headerName = id
#agent.sources.httpSrc.interceptors.uuidinterceptor.preserveExisting = false
#agent.sources.httpSrc.interceptors.uuidinterceptor.prefix = myhostname
agent.sources.httpSrc.channels = memoryChannel
70 | Cloudera Search
Cloudera Search User Guide
This example shows a flume.conf section for a SpoolDirectorySource with a BlobDeserializer for the
agent named agent:
agent.sources.spoolSrc.type = spooldir
agent.sources.spoolSrc.spoolDir = /tmp/myspooldir
agent.sources.spoolSrc.ignorePattern = \.
agent.sources.spoolSrc.deserializer =
org.apache.flume.sink.solr.morphline.BlobDeserializer$Builder
agent.sources.spoolSrc.deserializer.maxBlobLength = 2000000000
agent.sources.spoolSrc.batchSize = 1
agent.sources.spoolSrc.fileHeader = true
agent.sources.spoolSrc.fileHeaderKey = resourceName
agent.sources.spoolSrc.interceptors = uuidinterceptor
agent.sources.spoolSrc.interceptors.uuidinterceptor.type =
org.apache.flume.sink.solr.morphline.UUIDInterceptor$Builder
agent.sources.spoolSrc.interceptors.uuidinterceptor.headerName = id
#agent.sources.spoolSrc.interceptors.uuidinterceptor.preserveExisting = false
#agent.sources.spoolSrc.interceptors.uuidinterceptor.prefix = myhostname
agent.sources.spoolSrc.channels = memoryChannel
Morphlines can be seen as an evolution of Unix pipelines, where the data model is generalized to work with
streams of generic records, including arbitrary binary payloads. Morphlines can be embedded into Hadoop
components such as Search, Flume, MapReduce, Pig, Hive, and Sqoop.
The framework ships with a set of frequently used high-level transformation and I/O commands that can be
combined in application-specific ways. The plug-in system allows you to add new transformations and I/O
commands and integrates existing functionality and third-party systems.
This integration enables the following:
• Rapid Hadoop ETL application prototyping
• Complex stream and event processing in real time
• Flexible log file analysis
• Integration of multiple heterogeneous input schemas and file formats
• Reuse of ETL logic building blocks across Search applications
Cloudera Search | 71
Cloudera Search User Guide
The high-performance Cloudera runtime compiles a morphline, processing all commands for a morphline in the
same thread and adding no artificial overhead. For high scalability, you can deploy many morphline instances
on a cluster in many Flume agents and MapReduce tasks.
The following components execute morphlines:
• MapReduceIndexerTool
• Flume Morphline Solr Sink and Flume MorphlineInterceptor
Cloudera also provides a corresponding Cloudera Search Tutorial.
72 | Cloudera Search
Cloudera Search User Guide
Morphline Characteristics
A command can contain nested commands. Thus, a morphline is a tree of commands, akin to a push-based
data flow engine or operator tree in DBMS query execution engines.
A morphline has no notion of persistence, durability, distributed computing, or host failover. A morphline is
basically just a chain of in-memory transformations in the current thread. There is no need for a morphline to
manage multiple processes, hosts, or threads because this is already addressed by host systems such as
MapReduce, Flume, or Storm. However, a morphline does support passing notifications on the control plane to
command subtrees. Such notifications include BEGIN_TRANSACTION, COMMIT_TRANSACTION,
ROLLBACK_TRANSACTION, SHUTDOWN.
The morphline configuration file is implemented using the HOCON format (Human-Optimized Config Object
Notation). HOCON is basically JSON slightly adjusted for configuration file use cases. HOCON syntax is defined
at HOCON github page and is also used by Akka and Play.
Cloudera Search | 73
Cloudera Search User Guide
$ wget http://archive.apache.org/dist/avro/avro-1.7.4/java/avro-tools-1.7.4.jar
$ java -jar avro-tools-1.7.4.jar tojson \
/usr/share/doc/search*/examples/test-documents/sample-statuses-20120906-141433.avro
{
"type" : "record",
"name" : "Doc",
"doc" : "adoc",
"fields" : [ {
"name" : "id",
"type" : "string"
}, {
"name" : "user_statuses_count",
"type" : [ "int", "null" ]
}, {
"name" : "user_screen_name",
"type" : [ "string", "null" ]
}, {
"name" : "created_at",
"type" : [ "string", "null" ]
}, {
"name" : "text",
"type" : [ "string", "null" ]
}
...
]
}
3. Extract the id, user_screen_name, created_at, and text fields from the Avro records, and then store and
index them in Solr, using the following Solr schema definition in schema.xml:
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true"
multiValued="false" />
<field name="username" type="text_en" indexed="true" stored="true" />
<field name="created_at" type="tdate" indexed="true" stored="true" />
<field name="text" type="text_en" indexed="true" stored="true" />
<field name="_version_" type="long" indexed="true" stored="true"/>
<dynamicField name="ignored_*" type="ignored"/>
</fields>
The Solr output schema omits some Avro input fields, such as user_statuses_count. If your data includes
Avro input fields that are not included in the Solr output schema, you may want to make changes to data as
it is ingested. For example, suppose you need to rename the input field user_screen_name to the output
field username. Also suppose that the time format for the created_at field is yyyy-MM-dd'T'HH:mm:ss'Z'.
Finally, suppose any unknown fields present are to be removed. Recall that Solr throws an exception on any
attempt to load a document that contains a field that is not specified in schema.xml.
4. These transformation rules that make it possible to modify data so it fits your particular schema can be
expressed with morphline commands called readAvroContainer, extractAvroPaths, convertTimestamp,
sanitizeUnknownSolrFields and loadSolr, by editing a morphline.conf file.
74 | Cloudera Search
Cloudera Search User Guide
Note: The following example uses the Kite SDK, which applies to Search for CDH 5. In the case of
morphlines.conf files used with Search 5.4.2 and earlier, which uses CDK, the importCommands
are different.
For the following morphlines.conf file to apply to CDK, you replace importCommands :
["org.kitesdk.morphline.**", "com.ngdata.**"] with importCommands :
["com.cloudera.cdk.morphline.**", "com.ngdata.**"].
# ZooKeeper ensemble
zkHost : "127.0.0.1:2181/solr"
}
# Import all morphline commands in these java packages and their subpackages.
# Other commands that may be present on the classpath are not visible to this
# morphline.
importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
commands : [
{
# Parse Avro container file and emit a record for each Avro object
readAvroContainer {
# Optionally, require the input to match one of these MIME types:
# supportedMimeTypes : [avro/binary]
{
# Consume the output record of the previous command and pipe another
# record downstream.
#
# extractAvroPaths is a command that uses zero or more Avro path
# excodeblockssions to extract values from an Avro object. Each
excodeblockssion
# consists of a record output field name, which appears to the left of the
# colon ':' and zero or more path steps, which appear to the right.
# Each path step is separated by a '/' slash. Avro arrays are
# traversed with the '[]' notation.
#
# The result of a path excodeblockssion is a list of objects, each of which
Cloudera Search | 75
Cloudera Search User Guide
# Consume the output record of the previous command and pipe another
# record downstream.
#
# convert timestamp field to native Solr timestamp format
# such as 2012-09-06T07:14:34Z to 2012-09-06T07:14:34.000Z
{
convertTimestamp {
field : created_at
inputFormats : ["yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd"]
inputTimezone : America/Los_Angeles
outputFormat : "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
outputTimezone : UTC
}
}
# Consume the output record of the previous command and pipe another
# record downstream.
#
# This command deletes record fields that are unknown to Solr
# schema.xml.
#
# Recall that Solr throws an exception on any attempt to load a document
# that contains a field that is not specified in schema.xml.
{
sanitizeUnknownSolrFields {
# Location from which to fetch Solr schema
solrLocator : ${SOLR_LOCATOR}
}
}
76 | Cloudera Search
Cloudera Search User Guide
The program extracts the following record from the log line and loads it into Solr:
syslog_pri:164
syslog_timestamp:Feb 4 10:46:14
syslog_hostname:syslog
syslog_program:sshd
syslog_pid:607
syslog_message:listening on 0.0.0.0 port 22.
Use the following rules to create a chain of transformation commands, which are expressed with the readLine,
grok, and logDebug morphline commands, by editing a morphline.conf file.
Note:
For the following morphlines.conf file to apply to CDK, you replace importCommands :
["org.kitesdk.morphline.**", "com.ngdata.**"] with importCommands :
["com.cloudera.cdk.morphline.**", "com.ngdata.**"].
Note: The following example uses the Kite SDK, which applies to Search for CDH 5. In the case of
morphlines.conf files used with Search 5.4.2 and earlier, which uses CDK, the importCommands are
different.
# ZooKeeper ensemble
zkHost : "127.0.0.1:2181/solr"
}
commands : [
{
readLine {
charset : UTF-8
}
}
{
grok {
# a grok-dictionary is a config file that contains prefabricated regular
expressions
# that can be referred to by name.
# grok patterns specify such a regex name, plus an optional output field
name.
# The syntax is %{REGEX_NAME:OUTPUT_FIELD_NAME}
# The input line is expected in the "message" input field.
Cloudera Search | 77
Cloudera Search User Guide
dictionaryFiles : [target/test-classes/grok-dictionaries]
expressions : {
message : """<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp}
%{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?:
%{GREEDYDATA:syslog_message}"""
}
}
}
# Consume the output record of the previous command and pipe another
# record downstream.
#
# This command deletes record fields that are unknown to Solr
# schema.xml.
#
# Recall that Solr throws an exception on any attempt to load a document
# that contains a field that is not specified in schema.xml.
{
sanitizeUnknownSolrFields {
# Location from which to fetch Solr schema
solrLocator : ${SOLR_LOCATOR}
}
}
]
}
]
Next Steps
Learn more about morphlines and Kite. Cloudera Search 5.4.2 includes CDK version 0.9.1. For more information,
see:
• CDK Morphlines Reference Guide.
• More example morphlines can be found in the unit tests.
78 | Cloudera Search
Cloudera Search User Guide
$ hbase shell
$ cat $HOME/morphline-hbase-mapper.xml
<?xml version="1.0"?>
<indexer table="record"
mapper="com.ngdata.hbaseindexer.morphline.MorphlineResultToSolrMapper">
<!-- The relative or absolute path on the local file system to the
morphline configuration file. -->
<!-- Use relative path "morphlines.conf" for morphlines managed by
Cloudera Manager -->
<param name="morphlineFile" value="/etc/hbase-solr/conf/morphlines.conf"/>
</indexer>
The Lily HBase Indexer configuration file also supports the standard attributes of any HBase Lily Indexer on the
top-level <indexer> element: table, mapping-type, read-row, unique-key-formatter,
unique-key-field, row-field, and column-family-field. It does not support the <field> element
and <extract> elements.
Cloudera Search | 79
Cloudera Search User Guide
number of morphline commands. Typically, an extractHBaseCells command is the first command. The
readAvroContainer or readAvro morphline commands are often used to extract Avro data from the HBase
byte array. This configuration file can be shared among different applications that use morphlines.
Note: The following example uses the Kite SDK, which applies to Search for CDH 5. In the case of
morphlines.conf files used with Search 5.4.2 and earlier, which uses CDK, the importCommands are
different.
For the following morphlines.conf file to apply to CDK, you replace importCommands :
["org.kitesdk.morphline.**", "com.ngdata.**"] with importCommands :
["com.cloudera.cdk.morphline.**", "com.ngdata.**"].
$ cat /etc/hbase-solr/conf/morphlines.conf
morphlines : [
{
id : morphline1
importCommands : ["org.kitesdk.morphline.**", "com.ngdata.**"]
commands : [
{
extractHBaseCells {
mappings : [
{
inputColumn : "data:*"
outputField : "data"
type : string
source : value
}
#{
# inputColumn : "data:item"
# outputField : "_attachment_body"
# type : "byte[]"
# source : value
#}
]
}
}
Note: To function properly, the morphline must not contain a loadSolr command. The enclosing
Lily HBase Indexer must load documents into Solr, instead the morphline itself.
80 | Cloudera Search
Cloudera Search User Guide
• The inputColumn parameter, which specifies the data from HBase for populating a field in Solr. It has the
form of a column family name and qualifier, separated by a colon. The qualifier portion can end in an asterisk,
which is interpreted as a wildcard. In this case, all matching column-family and qualifier expressions are
used. The following are examples of valid inputColumn values:
– mycolumnfamily:myqualifier
– mycolumnfamily:my*
– mycolumnfamily:*
• The outputField parameter specifies the morphline record field to which to add output values. The morphline
record field is also known as the Solr document field. Example: first_name.
• Dynamic output fields are enabled by the outputField parameter ending with a * wildcard. For example:
inputColumn : "m:e:*"
outputField : "belongs_to_*"
belongs_to_1 : foo
belongs_to_9 : bar
• The type parameter defines the data type of the content in HBase. All input data is stored in HBase as byte
arrays, but all content in Solr is indexed as text, so a method for converting byte arrays to the actual data
type is required. The type parameter can be the name of a type that is supported by
org.apache.hadoop.hbase.util.Bytes.to* (which currently includes byte[], int, long, string, boolean,
float, double, short, and bigdecimal). Use type byte[] to pass the byte array through to the morphline
without conversion.
– type:byte[] copies the byte array unmodified into the record output field
– type:int converts with org.apache.hadoop.hbase.util.Bytes.toInt
– type:long converts with org.apache.hadoop.hbase.util.Bytes.toLong
– type:string converts with org.apache.hadoop.hbase.util.Bytes.toString
– type:boolean converts with org.apache.hadoop.hbase.util.Bytes.toBoolean
– type:float converts with org.apache.hadoop.hbase.util.Bytes.toFloat
– type:double converts with org.apache.hadoop.hbase.util.Bytes.toDouble
– type:short converts with org.apache.hadoop.hbase.util.Bytes.toShort
– type:bigdecimal converts with org.apache.hadoop.hbase.util.Bytes.toBigDecimal
Alternatively, the type parameter can be the name of a Java class that implements the
com.ngdata.hbaseindexer.parse.ByteArrayValueMapper interface.
• The source parameter determines which portion of an HBase KeyValue is used as indexing input. Valid
choices are value or qualifier. When value is specified, the HBase cell value is used as input for indexing.
When qualifier is specified, then the HBase column qualifier is used as input for indexing. The default is
value.
Running HBaseMapReduceIndexerTool
Run HBaseMapReduceIndexerTool to index the HBase table using a MapReduce job, as follows:
Cloudera Search | 81
Cloudera Search User Guide
Note: For development purposes, use the --dry-run option to run in local mode and print documents
to stdout, instead of loading them to Solr. Using this option causes the morphline to execute in the
client process without submitting a job to MapReduce. Executing in the client process provides quicker
results during early trial and debug sessions.
Note: To print diagnostic information, such as the content of records as they pass through morphline
commands, enable TRACE log level diagnostics by adding the following to your log4j.properties
file:
log4j.logger.com.cloudera.cdk.morphline=TRACE
log4j.logger.com.ngdata=TRACE
The log4j.properties file can be passed using the --log4j command-line option.
HBaseMapReduceIndexerTool
HBaseMapReduceIndexerTool is a MapReduce batch job driver that takes input data from an HBase table, creates
Solr index shards, and writes the indexes into HDFS in a flexible, scalable, and fault-tolerant manner. It also
supports merging the output shards into a set of live customer-facing Solr servers in SolrCloud.
Note: Merging output shards into live customer-facing Solr servers can only be completed if all
replicas are online.
MapReduce batch job driver that takes input data from an HBase table and
creates Solr index shards and writes the indexes into HDFS, in a flexible,
scalable, and fault-tolerant manner. It also supports merging the output
shards into a set of live customer-facing Solr servers in SolrCloud.
Optionally, documents can be sent directly from the mapper tasks to
SolrCloud, which is a much less scalable approach but enables updating
existing documents in SolrCloud. The program proceeds in one or multiple
consecutive MapReduce-based phases, as follows:
1) Mapper phase: This (parallel) phase scans over the input HBase table,
extracts the relevant content, and transforms it into SolrInputDocuments.
If run as a mapper-only job, this phase also writes the SolrInputDocuments
82 | Cloudera Search
Cloudera Search User Guide
4) Go-live phase: This optional (parallel) phase merges the output shards
of the previous phase into a set of live customer-facing Solr servers in
SolrCloud. If this phase is omitted you can explicitly point each Solr
server to one of the HDFS output shard directories
Fault Tolerance: Mapper and reducer task attempts are retried on failure
per the standard MapReduce semantics. On program startup all data in the --
output-dir is deleted if that output directory already exists and --
overwrite-output-dir is specified. This means that if the whole job fails
you can retry simply by rerunning the program again using the same
arguments.
--hbase-indexer-zk STRING
The address of the ZooKeeper ensemble from which
to fetch the indexer definition named --hbase-
indexer-name. Format is: a list of comma
separated host:port pairs, each corresponding to
a zk server. Example: '127.0.0.1:2181,127.0.0.1:
2182,127.0.0.1:2183'
--hbase-indexer-name STRING
The name of the indexer configuration to fetch
from the ZooKeeper ensemble specified with --
hbase-indexer-zk. Example: myIndexer
--hbase-indexer-file FILE
Optional relative or absolute path to a local
HBase indexer XML configuration file. If supplied,
this overrides --hbase-indexer-zk and
--hbase-indexer-name. Example:
/path/to/morphline-hbase-mapper.xml
--hbase-indexer-component-factory STRING
Classname of the hbase indexer component factory.
--hbase-table-name STRING
Optional name of the HBase table containing the
records to be indexed. If supplied, this
overrides the value from the --hbase-indexer-*
options. Example: myTable
--hbase-start-row BINARYSTRING
Binary string representation of start row from
which to start indexing (inclusive). The format
of the supplied row key should use two-digit hex
values prefixed by \x for non-ASCII characters (e.
g. 'row\x00'). The semantics of this argument are
the same as those for the HBase Scan#setStartRow
method. The default is to include the first row
of the table. Example: AAAA
--hbase-end-row BINARYSTRING
Binary string representation of end row prefix at
which to stop indexing (exclusive). See the
description of --hbase-start-row for more
information. The default is to include the last
row of the table. Example: CCCC
Cloudera Search | 83
Cloudera Search User Guide
--hbase-start-time STRING
Earliest timestamp (inclusive) in time range of
HBase cells to be included for indexing. The
default is to include all cells. Example: 0
--hbase-end-time STRING
Latest timestamp (exclusive) of HBase cells to be
included for indexing. The default is to include
all cells. Example: 123456789
--hbase-timestamp-format STRING
Timestamp format to be used to interpret --hbase-
start-time and --hbase-end-time. This is a java.
text.SimpleDateFormat compliant format (see http:
//docs.oracle.
com/javase/6/docs/api/java/text/SimpleDateFormat.
html). If this parameter is omitted then the
timestamps are interpreted as number of
milliseconds since the standard epoch (Unix
time). Example: "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
Go live arguments:
Arguments for merging the shards that are built into a live Solr
cluster. Also see the Cluster arguments.
Optional arguments:
--help, -help, -h Show this help message and exit
--output-dir HDFS_URI HDFS directory to write Solr indexes to. Inside
there one output directory per shard will be
generated. Example: hdfs://c2202.mycompany.
84 | Cloudera Search
Cloudera Search User Guide
com/user/$USER/test
--overwrite-output-dir
Overwrite the directory specified by --output-dir
if it already exists. Using this parameter will
result in the output directory being recursively
deleted at job startup. (default: false)
--morphline-file FILE Relative or absolute path to a local config file
that contains one or more morphlines. The file
must be UTF-8 encoded. The file will be uploaded
to each MR task. If supplied, this overrides the
value from the --hbase-indexer-* options.
Example: /path/to/morphlines.conf
--morphline-id STRING The identifier of the morphline that shall be
executed within the morphline config file, e.g.
specified by --morphline-file. If the --morphline-
id option is omitted the first (i.e. top-most)
morphline within the config file is used. If
supplied, this overrides the value from the --
hbase-indexer-* options. Example: morphline1
--update-conflict-resolver FQCN
Fully qualified class name of a Java class that
implements the UpdateConflictResolver interface.
This enables deduplication and ordering of a
series of document updates for the same unique
document key. For example, a MapReduce batch job
might index multiple files in the same job where
some of the files contain old and new versions of
the very same document, using the same unique
document key.
Typically, implementations of this interface
forbid collisions by throwing an exception, or
ignore all but the most recent document version,
or, in the general case, order colliding updates
ascending from least recent to most recent
(partial) update. The caller of this interface (i.
e. the Hadoop Reducer) will then apply the
updates to Solr in the order returned by the
orderUpdates() method.
The default
RetainMostRecentUpdateConflictResolver
implementation ignores all but the most recent
document version, based on a configurable numeric
Solr field, which defaults to the
file_last_modified timestamp (default: org.apache.
solr.hadoop.dedup.
RetainMostRecentUpdateConflictResolver)
--reducers INTEGER Tuning knob that indicates the number of reducers
to index into. 0 indicates that no reducers
should be used, and documents should be sent
directly from the mapper tasks to live Solr
servers. -1 indicates use all reduce slots
available on the cluster. -2 indicates use one
reducer per output shard, which disables the
mtree merge MR algorithm. The mtree merge MR
algorithm improves scalability by spreading load
(in particular CPU load) among a number of
parallel reducers that can be much larger than
the number of solr shards expected by the user.
It can be seen as an extension of concurrent
lucene merges and tiered lucene merges to the
clustered case. The subsequent mapper-only phase
merges the output of said large number of
reducers to the number of shards expected by the
user, again by utilizing more available
parallelism on the cluster. (default: -1)
--max-segments INTEGER
Tuning knob that indicates the maximum number of
segments to be contained on output in the index
of each reducer shard. After a reducer has built
its output index it applies a merge policy to
merge segments until there are <= maxSegments
lucene segments left in this index. Merging
segments involves reading and rewriting all data
Cloudera Search | 85
Cloudera Search User Guide
Examples:
86 | Cloudera Search
Cloudera Search User Guide
# (Re)index a table in GoLive mode using a local morphline-based indexer config file
# Also include extra library jar file containing JSON tweet Java parser:
hadoop --config /etc/hadoop/conf \
jar hbase-indexer-mr-*-job.jar \
--conf /etc/hbase/conf/hbase-site.xml \
--libjars /path/to/kite-morphlines-twitter-0.10.0.jar \
-D 'mapred.child.java.opts=-Xmx500m' \
--hbase-indexer-file src/test/resources/morphline_indexer_without_zk.xml \
--zk-host 127.0.0.1/solr \
--collection collection1 \
--go-live \
--morphline-file src/test/resources/morphlines.conf \
--output-dir hdfs://c2202.mycompany.com/user/$USER/test \
--overwrite-output-dir \
--log4j src/test/resources/log4j.properties
Cloudera Search | 87
Cloudera Search User Guide
Configuring the Lily HBase NRT Indexer Service for Use with Cloudera
Search
The Lily HBase NRT Indexer Service is a flexible, scalable, fault-tolerant, transactional, near real-time (NRT)
system for processing a continuous stream of HBase cell updates into live search indexes. Typically it takes
seconds for data ingested into HBase to appear in search results; this duration is tunable. The Lily HBase Indexer
uses SolrCloud to index data stored in HBase. As HBase applies inserts, updates, and deletes to HBase table
cells, the indexer keeps Solr consistent with the HBase table contents, using standard HBase replication. The
indexer supports flexible custom application-specific rules to extract, transform, and load HBase data into Solr.
Solr search results can contain columnFamily:qualifier links back to the data stored in HBase. This way,
applications can use the Search result set to directly access matching raw HBase cells. Indexing and searching
do not affect operational stability or write throughput of HBase because the indexing and searching processes
are separate and asynchronous to HBase.
The Lily HBase NRT Indexer Service must be deployed in an environment with a running HBase cluster, a running
SolrCloud cluster, and at least one ZooKeeper cluster. This can be done with or without Cloudera Manager. See
The Lily HBase Indexer Service in Managing Clusters with Cloudera Manager for more information.
Pointing a Lily HBase NRT Indexer Service at an HBase Cluster that Needs to Be Indexed
Before starting Lily HBase NRT Indexer services, you must configure individual services with the location of a
ZooKeeper ensemble that is used for the target HBase cluster. Add the following property to
/etc/hbase-solr/conf/hbase-indexer-site.xml. Remember to replace hbase-cluster-zookeeper with
the actual ensemble string found in the hbase-site.xml configuration file:
<property>
<name>hbase.zookeeper.quorum</name>
<value>hbase-cluster-zookeeper</value>
</property>
Configure all Lily HBase NRT Indexer Services to use a particular ZooKeeper ensemble to coordinate with one
other. Add the following property to /etc/hbase-solr/conf/hbase-indexer-site.xml, and replace
hbase-cluster-zookeeper:2181 with the actual ensemble string:
<property>
<name>hbaseindexer.zookeeper.connectstring</name>
<value>hbase-cluster-zookeeper:2181</value>
</property>
88 | Cloudera Search
Cloudera Search User Guide
Note:
The HTTP/ component of the HTTP service user principal must be upper case as shown in the
syntax and example above.
<property>
<name>hbaseindexer.authentication.type</name>
<value>kerberos</value>
</property>
<property>
<name>hbaseindexer.authentication.kerberos.keytab</name>
<value>hbase.keytab</value>
</property>
<property>
<name>hbaseindexer.authentication.kerberos.principal</name>
<value>HTTP/localhost@LOCALHOST</value>
</property>
<property>
<name>hbaseindexer.authentication.kerberos.name.rules</name>
Cloudera Search | 89
Cloudera Search User Guide
<value>DEFAULT</value>
</property>
2. Set up the Java Authentication and Authorization Service (JAAS). Create a jaas.conf file in the HBase-Indexer
configuration directory containing the following settings. Make sure that you substitute a value for principal
that matches your particular environment.
Client {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
useTicketCache=false
keyTab="/etc/hbase/conf/hbase.keytab"
principal="hbase/fully.qualified.domain.name@<YOUR-REALM>";
};
Then, modify hbase-indexer-env.sh in the hbase-indexer configuration directory to add the jaas
configuration to the system properties. You can do this by adding -Djava.security.auth.login.config
to the HBASE_INDEXER_OPTS. For example, you might add the following:
HBASE_INDEXER_OPTS = "$HBASE_INDEXER_OPTS
-Djava.security.auth.login.config=/path/to/your/jaas.conf"
Sentry integration
The Lily HBase Indexer uses a file-based access control model similar to that provided by Solr-Sentry integration,
which is described in Enabling Sentry Authorization for Search using the Command Line on page 99. The model
supports specifying READ and WRITE privileges for each indexer. The privileges work as follows:
• If role has WRITE privilege for indexer1, a call to create, update, or delete indexer1 succeeds.
• If role has READ privilege for indexer1, a call to list-indexers will list indexer1, if it exists. If an indexer called
indexer2 exists, but the role doesn't have READ privileges for it, information about indexer2 is filtered out of
the response.
To configure Sentry for the Lily HBase Indexer, add the following properties to hbase-indexer-site.xml:
<property>
<name>sentry.hbaseindexer.sentry.site</name>
<value>sentry-site.xml</value> (full or relative path)
</property>
<property>
<name>hbaseindexer.rest.resource.package</name>
<value>org/apache/sentry/binding/hbaseindexer/rest</value>
</property>
90 | Cloudera Search
Cloudera Search User Guide
Note: These settings can be added using Cloudera Manager or by manually editing the
hbase-indexer-site.xml file.
After starting the Lily HBase NRT Indexer Services, verify that all daemons are running using the jps tool from
the Oracle JDK, which you can obtain from the Java SE Downloads page. If you are running a pseudo-distributed
HDFS installation and a Lily HBase NRT Indexer Service installation on one machine, jps shows the following
output:
$ hbase shell
hbase shell> disable 'record'
hbase shell> alter 'record', {NAME => 'data', REPLICATION_SCOPE => 1}
hbase shell> enable 'record'
For every new table, set the REPLICATION_SCOPE on every column family that needs to be indexed by issuing
a command of the form:
$ hbase shell
hbase shell> create 'record', {NAME => 'data', REPLICATION_SCOPE => 1}
Cloudera Search | 91
Cloudera Search User Guide
Registering a Lily HBase Indexer Configuration with the Lily HBase Indexer Service
When the content of the Lily HBase Indexer configuration XML file is satisfactory, register it with the Lily HBase
Indexer Service. Register the Lily HBase Indexer configuration file by uploading the Lily HBase Indexer configuration
XML file to ZooKeeper. For example:
$ hbase-indexer add-indexer \
--name myIndexer \
--indexer-conf $HOME/morphline-hbase-mapper.xml \
--connection-param solr.zk=solr-cloude-zk1,solr-cloude-zk2/solr \
--connection-param solr.collection=hbase-collection1 \
--zookeeper hbase-cluster-zookeeper:2181
$ hbase-indexer list-indexers
Number of indexes: 1
myIndexer
+ Lifecycle state: ACTIVE
+ Incremental indexing state: SUBSCRIBE_AND_CONSUME
+ Batch indexing state: INACTIVE
+ SEP subscription ID: Indexer_myIndexer
+ SEP subscription timestamp: 2013-06-12T11:23:35.635-07:00
+ Connection type: solr
+ Connection params:
+ solr.collection = hbase-collection1
+ solr.zk = localhost/solr
+ Indexer config:
110 bytes, use -dump to see content
+ Batch index config:
(none)
+ Default batch index config:
(none)
+ Processes
+ 1 running processes
+ 0 failed processes
Use the update-indexer and delete-indexer command-line options of the hbase-indexer utility to
manipulate existing Lily HBase Indexers.
For more help, use the following commands:
The morphlines.conf configuration file must be present on every host that runs an indexer.
You can use the Cloudera Manager Admin Console to update morphlines.conf:
1. On the Cloudera Manager Home page, click the Key-Value Indexer Store, often KS_INDEXER-1.
2. Click the Configuration tab.
3. Select Scope > KS_INDEXER (Service Wide)
4. Select Category > Morphlines.
5. For the Morphlines File property, paste the new morphlines.conf content into the Value field.
6. Click Save Changes to commit the changes.
Cloudera Manager automatically copies pasted configuration files to the current working directory of all Lily
HBase Indexer cluster processes on start and restart of the Lily HBase Indexer Service. In this case, the file
location /etc/hbase-solr/conf/morphlines.conf is not applicable.
Morphline configuration files can be changed without re-creating the indexer itself. In such a case, you must
restart the Lily HBase Indexer service.
92 | Cloudera Search
Cloudera Search User Guide
$ hbase shell
hbase(main):001:0> put 'record', 'row1', 'data', 'value'
hbase(main):002:0> put 'record', 'row2', 'data', 'value2'
If the put operation succeeds, wait a few seconds, navigate to the SolrCloud UI query page, and query the data.
Note the updated rows in Solr.
To print diagnostic information, such as the content of records as they pass through the morphline commands,
enable the TRACE log level. For example, you might add two lines to your log4j.properties file:
log4j.logger.com.cloudera.cdk.morphline=TRACE
log4j.logger.com.ngdata=TRACE
In Cloudera Manager 5, navigate to Clusters > KS_INDEXER-1 > Configuration > View and Edit > Lily HBase
Indexer > Advanced > Lily HBase Indexer Logging Safety Valve, and then restart the Lily HBase Indexer Service.
• Go to the KS_INDEXER service.
• Click the Configuration tab.
• Select Scope > Lily HBase Indexer.
• Select Category > Advanced.
• Locate the Lily HBase Indexer Logging Advanced Configuration Snippet (Safety Valve) property or search for
it by typing its name in the Search box.
If more than one role group applies to this configuration, edit the value for the appropriate role group. See
Modifying Configuration Properties.
• Click Save Changes to commit the changes.
Note: The name of the particular key-value store indexer can vary. The most common variation is a
different number at the end of the name.
With the default non-schemaless mode, you create a schema by writing a schema.xml file before loading data
into Solr so it can be used by Cloudera Search. You typically write a different schema definition for each type of
data being ingested, because the different types usually have different field names and values. This is done by
examining the data to be imported so its structure can be understood, and then creating a schema that
accommodates that data. For example, emails might have a field for recipients and log files might have a field
for IP addresses for machines reporting errors. Conversely, emails typically do not have an IP address field and
log files typically do not have recipients. Therefore, The schema you use to import emails is different from the
schema you use to import log files.
Cloudera Search offers schemaless mode to help facilitate sample deployments without the need to pre-define
a schema. While schemaless is not suitable for production environments, it can help demonstrate the functionality
and features of Cloudera Search. Schemaless mode operates based on three principles:
Cloudera Search | 93
Cloudera Search User Guide
1. The schema is automatically updated using an API. When not using schemaless mode, users manually modify
the schema.xml file or use the Schema API.
2. As data is ingested, it is analyzed and a guess is made about the type of data in the field. Supported types
include Boolean, Integer, Long, Float, Double, Date, and Text.
3. When a new field is encountered, the schema is automatically updated using the API. The update is based
on the guess about the type of data in the field.
For example, if schemaless encounters a field that contains "6.022", this would be determined to be type Float,
whereas "Mon May 04 09:51:52 CDT 2009" would be determined to be type Date.
By combining these techniques, Schemaless:
1. Starts without a populated schema.
2. Intakes and analyzes data.
3. Modifies the schema based on guesses about the data.
4. Ingests the data so it can be searched based on the schema updates.
To generate a configuration for use in Schemaless mode, use solrctl instancedir --generate path
-schemaless. Then, create the instancedir and collection as with non-schemaless mode. For more information,
see Solrctl Reference on page 50.
Best Practices
User Defined Schemas Recommended for Production Use Cases
Schemaless Solr is useful for getting started quickly and for understanding the underlying structure of the data
you wish to search. However, Schemaless Solr is not recommended for production use cases. Because the
schema is automatically generated, a mistake like misspelling the name of the field alters the schema, rather
than producing an error. The mistake may not be caught until much later and once caught, may require re-indexing
to fix. Also, an unexpected input format may cause the type guessing to pick a field type that is incompatible
with data that is subsequently ingested, preventing further ingestion until the incompatibility is manually
addressed. Such a case is rare, but could occur. For example, if the first instance of a field was an integer, such
as '9', but subsequent entries were text such as '10 Spring Street', the schema would make it impossible to
properly ingest those subsequent entries. Therefore, Schemaless Solr may be useful for deciding on a schema
during the exploratory stage of development, but Cloudera recommends defining the schema in the traditional
way before moving to production.
Give each Collection its own unique Instancedir
Solr supports using the same instancedir for multiple collections. In schemaless mode, automatic schema field
additions actually change the underlying instancedir. Thus, if two collections are using the same instancedir,
schema field additions meant for one collection will actually affect the other one as well. Therefore, it is
recommended that each collection have its own instancedir.
94 | Cloudera Search
Cloudera Search User Guide
Note: Cloudera Search does not support using a proxy for high availability in an environment that
requires Kerberos authentication.
The following setup steps are a general outline that apply to any load-balancing proxy software.
1. Download the load-balancing proxy software. It should only need to be installed and configured on a single
host.
2. Configure the software, typically by editing a configuration file. Set up a port on which the load balancer
listens to relay Search requests back and forth.
3. Specify the host and port settings for each Solr service host. These are the hosts that the load balancer
chooses from when relaying each query. In most cases, use 8983, the default query and update port.
4. Run the load-balancing proxy server, pointing it at the configuration file that you set up.
Note:
The HTTP/ component of the HTTP service user principal must be upper case as shown in the
syntax and example above.
Cloudera Search | 95
Cloudera Search User Guide
Note: Modify the values for these properties to match your environment. For example, the
SOLR_AUTHENTICATION_KERBEROS_PRINCIPAL=HTTP/localhost@LOCALHOST must include the
principal instance and Kerberos realm for your environment. That is often different from
localhost@LOCALHOST.
Note: For information on how to configure the rules, see Configuring the Mapping from Kerberos
Principals to Short Names. For additional information on using Solr with HDFS, see Configuring
Solr for Use with HDFS on page 17.
3. If using applications that use the solrj library, set up the Java Authentication and Authorization Service
(JAAS).
a. Create a jaas.conf file in the Solr configuration directory containing the following settings. This file and
its location must match the SOLR_AUTHENTICATION_JAAS_CONF value. Make sure that you substitute a
value for principal that matches your particular environment.
Client {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
useTicketCache=false
keyTab="/etc/solr/conf/solr.keytab"
principal="solr/fully.qualified.domain.name@<YOUR-REALM>";
};
Using Kerberos
The process of enabling Solr clients to authenticate with a secure Solr is specific to the client. This section
demonstrates:
• Using Kerberos and curl
• Using solrctl
• Configuring SolrJ Library Usage.
This enables technologies including:
• Command line solutions
• Java applications
• The MapReduceIndexerTool
• Configuring Flume Morphline Solr Sink Usage
Secure Solr requires that the CDH components that it interacts with are also secure. Secure Solr interacts with
HDFS, ZooKeeper and optionally HBase, MapReduce, andFlume. See Cloudera Security or the CDH 4 Security
Guide for more information.
96 | Cloudera Search
Cloudera Search User Guide
Note: Depending on the tool used to connect, additional arguments may be required. For example,
with curl, --negotiate and -u are required. The username and password specified with -u is not
actually checked because Kerberos is used. As a result, any value such as foo:bar or even just : is
acceptable. While any value can be provided for -u, note that the option is required. Omitting -u
results in a 401 Unauthorized error, even though the -u value is not actually used.
Using solrctl
If you are using solrctl to manage your deployment in an environment that requires Kerberos authentication,
you must have valid Kerberos credentials, which you can get using kinit. For more information on solrctl,
see Solrctl Reference on page 50
Client {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=false
useTicketCache=true
principal="user/fully.qualified.domain.name@<YOUR-REALM>";
};
Client {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
keyTab="/path/to/keytab/user.keytab"
storeKey=true
useTicketCache=false
principal="user/fully.qualified.domain.name@<YOUR-REALM>";
};
• Java applications
Cloudera Search | 97
Cloudera Search User Guide
Set the Java system property java.security.auth.login.config. For example, if the JAAS configuration
file is located on the filesystem as /home/user/jaas-client.conf. The Java system property
java.security.auth.login.config must be set to point to this file. Setting a Java system property can
be done programmatically, for example using a call such as:
System.setProperty("java.security.auth.login.config",
"/home/user/jaas-client.conf");
• The MapReduceIndexerTool
The MapReduceIndexerTool uses SolrJ to pass the JAAS configuration file. Using the MapReduceIndexerTool
in a secure environment requires the use of the HADOOP_OPTS variable to specify the JAAS configuration file.
For example, you might issue a command such as the following:
HADOOP_OPTS="-Djava.security.auth.login.config=/home/user/jaas.conf" \
hadoop jar MapReduceIndexerTool
export HBASE_INDEXER_OPTS="-XX:+UseConcMarkSweepGC"
To:
export
HBASE_INDEXER_OPTS="-Djava.security.auth.login.config=/home/user/hbase-jaas.conf
-XX:+UseConcMarkSweepGC"
Client {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
useTicketCache=false
keyTab="/etc/flume-ng/conf/flume.keytab"
principal="flume/<fully.qualified.domain.name>@<YOUR-REALM>";
};
3. Add the flume JAAS configuration to the JAVA_OPTS in /etc/flume-ng/conf/flume-env.sh. For example,
you might change:
JAVA_OPTS="-Xmx500m"
to:
JAVA_OPTS="-Xmx500m
-Djava.security.auth.login.config=/etc/flume-ng/conf/jaas-client.conf"
98 | Cloudera Search
Cloudera Search User Guide
Note: Sentry for Search depends on Kerberos authentication. For additional information on using
Kerberos with Search, see Configuring Search to Use Kerberos on page 95 and Using Kerberos on
page 96.
This document describes configuring Sentry for Cloudera Search. For information about alternate ways to
configure Sentry or for information about installing Sentry for other services, see:
• Setting Up Search Authorization with Sentry for instructions for using Cloudera Manager 4 to install and
configure Search Authorization with Sentry.
• Impala Security for instructions on using Impala with Sentry.
• Sentry Installation to install the version of Sentry that was provided with CDH 4.
• Sentry Installation to install the version of Sentry that was provided with CDH 5.
collection=logs->action=Query
A role can contain multiple such rules, separated by commas. For example the engineer_role might contain
the Query privilege for hive_logs and hbase_logs collections, and the Update privilege for the current_bugs
collection. You would specify this as follows:
Cloudera Search | 99
Cloudera Search User Guide
• A configured group provider determines a user’s affiliation with a group. The current release supports
HDFS-backed groups and locally configured groups. For example,
Here the group dev_ops is granted the roles dev_role and ops_role. The members of this group can complete
searches that are allowed by these roles.
Important: You can use either Hadoop groups or local groups, but not both at the same time. Use
local groups if you want to do a quick proof-of-concept. For production, use Hadoop groups.
[users]
user1 = group1, group2, group3
user2 = group2, group3
<property>
<name>sentry.provider</name>
<value>org.apache.sentry.provider.file.LocalGroupResourceAuthorizationProvider</value>
</property>
Policy File
The sections that follow contain notes on creating and maintaining the policy file.
Defining Roles
Keep in mind that role definitions are not cumulative; the newer definition replaces the older one. For example,
the following results in role1 having privilege2, not privilege1 and privilege2.
role1 = privilege1
role1 = privilege2
Sample Configuration
This section provides a sample configuration.
Note: Sentry with CDH Search does not support multiple policy files. Other implementations of Sentry
such as Sentry for Hive do support different policy files for different databases, but Sentry for CDH
Search has no such support for multiple policies.
Policy File
The following is an example of a CDH Search policy file. The sentry-provider.ini would exist in an HDFS
location such as hdfs://ha-nn-uri/user/solr/sentry/sentry-provider.ini. This location must be
readable by Solr.
Note: Use separate policy files for each Sentry-enabled service. Using one file for multiple services
results in each service failing on the other services' entries. For example, with a combined Hive and
Search file, Search would fail on Hive entries and Hive would fail on Search entries.
sentry-provider.ini
[groups]
# Assigns each Hadoop group to its set of roles
engineer = engineer_role
ops = ops_role
dev_ops = engineer_role, ops_role
hbase_admin = hbase_admin_role
[roles]
# The following grants all access to source_code.
# "collection = source_code" can also be used as syntactic
# sugar for "collection = source_code->action=*"
engineer_role = collection = source_code->action=*
sentry-site.xml
<configuration>
<property>
<name>hive.sentry.provider</name>
<value>org.apache.sentry.provider.file.HadoopGroupResourceAuthorizationProvider</value>
</property>
<property>
<name>sentry.solr.provider.resource</name>
<value>/path/to/authz-provider.ini</value>
<!--
If the HDFS configuration files (core-site.xml, hdfs-site.xml)
pointed to by SOLR_HDFS_CONFIG in /etc/default/solr
point to HDFS, the path will be in HDFS;
alternatively you could specify a full path,
e.g.:hdfs://namenode:port/path/to/authz-provider.ini
-->
</property>
SOLR_SECURITY_ALLOWED_PROXYUSERS=hue,foo
SOLR_SECURITY_PROXYUSER_hue_HOSTS=*
SOLR_SECURITY_PROXYUSER_hue_GROUPS=*
SOLR_SECURITY_PROXYUSER_foo_HOSTS=host1,host2
SOLR_SECURITY_PROXYUSER_foo_GROUPS=bar
Note: Cloudera Manager has its own management of secure impersonation for Hue. To add additional
users for Secure Impersonation, use the environment variable safety value for Solr to set the
environment variables as above. Be sure to include hue in SOLR_SECURITY_ALLOWED_PROXYUSERS
if you want to use secure impersonation for hue.
which indicate each evaluation Sentry makes. The FilePermission is from the policy file, while
RequestPermission is the privilege required for the query. A RequestPermission will iterate over all appropriate
FilePermission settings until a match is found. If no matching privilege is found, Sentry returns false indicating
“Access Denied” .
If Cloudera Search throws an exception according the rules described above, the caller, meaning Flume Solr Sink
and MapReduceIndexerTool, can catch the exception and retry the task if it meets the criteria for such retries.
redeliver the transaction's events to the SolrSink approximately five seconds later. This redelivering of the
transaction event retries the ingest to Solr. This process of rolling back, backing off, and retrying continues until
ingestion eventually succeeds.
Here is a corresponding example Flume configuration file flume.conf:
agent.sinks.solrSink.isProductionMode = true
agent.sinks.solrSink.isIgnoringRecoverableExceptions = true
In addition, Flume SolrSink automatically attempts to load balance and failover among the hosts of a SolrCloud
before it considers the transaction rollback and retry. Load balancing and failover is done with the help of
ZooKeeper, which itself can be configured to be highly available.
Further, Cloudera Manager can configure Flume so it automatically restarts if its process crashes.
To tolerate extended periods of Solr downtime, you can configure Flume to use a high-performance transactional
persistent queue in the form of a FileChannel. A FileChannel can use any number of local disk drives to buffer
significant amounts of data. For example, you might buffer many terabytes of events corresponding to a week
of data. Further, using the optional replicating channels Flume feature, you can configure Flume to replicate the
same data both into HDFS as well as into Solr. Doing so ensures that if the Flume SolrSink channel runs out of
disk space, data delivery is still delivered to HDFS, and this data can later be ingested from HDFS into Solr using
MapReduce.
Many machines with many Flume Solr Sinks and FileChannels can be used in a failover and load balancing
configuration to improve high availability and scalability. Flume SolrSink servers can be either co-located with
live Solr servers serving end user queries, or Flume SolrSink servers can be deployed on separate industry
standard hardware for improved scalability and reliability. By spreading indexing load across a large number of
Flume SolrSink servers you can improve scalability. Indexing load can be replicated across multiple Flume SolrSink
servers for high availability, for example using Flume features such as Load balancing Sink Processor.
Note: This procedure should not be used in environments running JobTracker high availability (HA).
If you are running JobTracker HA, contact Cloudera customer support for further assistance.
Renaming hosts involves stopping services and agents, changing settings, and restarting services and agents.
You must not restart services or agents before you are instructed to do so. Starting services or agents early
may result in a nonfunctional system state.
This topic describes how to change some or all host names in your cluster. Begin by shutting down all services
in the cluster.
Prerequisites
Before changing host names, back up the Cloudera Manager database using a tool such as mysqldump. For more
information, see the MySQL Reference Manual. Store this backup in a safe location. If problems occur, this backup
can be used to restore the original cluster state.
Debian/Ubuntu systems:
4. Shutdown the Cloudera agents on the hosts whose names you are changing.
RHEL-compatible or SLES systems:
Debian/Ubuntu systems:
server_host=newhostname.example.com
Repeat this edit for all hosts that are managed by Cloudera Manager.
HOSTNAME=new.host.name.FQDN
For Debian systems, edit the hostname entries in the hostname file to include new hostname. For example,
you might delete the old hostname and add the new hostname to the /etc/hostname file so it reads:
new.host.name.FQDN
For SLES systems, edit the hostname entries in the HOSTNAME file to include new hostname. For example,
you might delete the old hostname and add the new hostname to the /etc/HOSTNAME file so it reads:
new.host.name.FQDN
2. Edit the /etc/hosts file. Replace all instances of the old hostname with the new hostname.
Note the HOST_ID value for each of the hosts you are modifying. This will be $ROW_ID in the subsequent
commands.
2. For the hosts you're changing use a command of the form:
For example, a full transcript of user input from such a process might be:
# mysql -u root -p
password>
Debian/Ubuntu systems:
Debian/Ubuntu systems:
Note: As stated earlier, this procedure should not be used in environments running JobTracker High
Availability (HA). If you have already completed the preceding steps in an environment with JobTracker
HA enabled, the subsequent steps should not be completed in your environment. Contact support
now.
Note: Do not start any other services. It is especially important that you not start HDFS.
2. Log into one of the hosts that is hosting the ZooKeeper server role.
3. Delete the nameservice znode. For a package based installation, delete the zkCli.sh file using a command
similar to:
$ rm -f /usr/lib/zookeeper/bin/zkCli.sh
For a parcel-based installation, delete the zkCli.sh file using a command similar to:
$ rm -f /opt/cloudera/parcels/CDH/lib/zookeeper/bin/zkCli.sh
4. Verify that the HA znode exists by checking for the hadoop-ha. For example:
zkCli$ ls /hadoop-ha
If the HA znode does not exist, use the Cloudera Manager Admin Console to select the HDFS service and then
choose Initialize High Availability State in ZooKeeper.
5. Delete the old znode. For example use a command similar to:
6. Use the Cloudera Manager Admin Console to initialize HA in ZooKeeper by clicking HDFS > Instances > Action >
Initialize High Availability State in Zookeeper….
<luceneMatchVersion>4.4</luceneMatchVersion>
General Tuning
The following tuning categories can be completed at any time. It is less important to implement these changes
before beginning to use your system.
General Tips
• Enabling multi-threaded faceting can provide better performance for field faceting. When multi-threaded
faceting is enabled, field faceting tasks are completed in a parallel with a thread working on every field
faceting task simultaneously. Performance improvements do not occur in all cases, but improvements are
likely when all of the following are true:
– The system uses highly concurrent hardware.
– Faceting operations apply to large data sets over multiple fields.
– There is not an unusually high number of queries occurring simultaneously on the system. Systems that
are lightly loaded or that are mainly engaged with ingestion and indexing may be helped by multi-threaded
faceting; for example, a system ingesting articles and being queried by a researcher. Systems heavily
loaded by user queries are less likely to be helped by multi-threaded faceting; for example, an e-commerce
site with heavy user-traffic.
Note: Multi-threaded faceting only applies to field faceting and not to query faceting.
• Field faceting identifies the number of unique entries for a field. For example, multi-threaded
faceting could be used to simultaneously facet for the number of unique entries for the fields,
"color" and "size". In such a case, there would be two threads, and each thread would work on
faceting one of the two fields.
• Query faceting identifies the number of unique entries that match a query for a field. For
example, query faceting could be used to find the number of unique entries in the "size" field
are between 1 and 5. Multi-threaded faceting does not apply to these operations.
To enable multi-threaded faceting, add facet-threads to queries. For example, to use up to 1000 threads,
you might use a query as follows:
http://localhost:8983/solr/collection1/select?q=*:*&facet=true&fl=id&facet.field=f0_ws&facet.threads=1000
Configuration
The following parameters control caching. They can be configured at the Solr process level by setting the respective
system property or by editing the solrconfig.xml directly.
Note:
Increasing the direct memory cache size may make it necessary to increase the maximum direct
memory size allowed by the JVM. Add the following to /etc/default/solr or
/opt/cloudera/parcels/CDH-*/etc/default/solr to do so. You must also replace MAXMEM
with a reasonable upper limit. A typical default JVM value for this is 64 MB. When using MAXMEM,
you must specify a unit such as g for gigabytes or m for megabytes. If MAXMEM were set to 2, the
following command would set MaxDirectMemorySize to 2 GB:
CATALINA_OPTS="-XX:MaxDirectMemorySize=MAXMEMg -XX:+UseLargePages"
Each Solr slab allocates the slab's memory, which is 128 MB by default, as well as allocating some
additional direct memory overhead. Therefore, ensure that the MaxDirectMemorySize is set
comfortably above the value expected for slabs alone. The amount of additional memory required
varies according to multiple factors, but for most cases, setting MaxDirectMemorySize to at least
20-30% more than the total memory configured for slabs is sufficient. Setting the
MaxDirectMemorySize to the number of slabs multiplied by the slab size does not provide enough
memory.
Restart Solr servers after editing parameters.
Solr HDFS optimizes caching when performing NRT indexing using Lucene's NRTCachingDirectory.
Lucene caches a newly created segment if both of the following conditions are true:
• The segment is the result of a flush or a merge and the estimated size of the merged segment is <=
solr.hdfs.nrtcachingdirectory.maxmergesizemb.
• The total cached bytes is <= solr.hdfs.nrtcachingdirectory.maxcachedmb.
The following parameters control NRT caching behavior:
<directoryFactory name="DirectoryFactory">
<bool name="solr.hdfs.blockcache.enabled">${solr.hdfs.blockcache.enabled:true}</bool>
<int
name="solr.hdfs.blockcache.slab.count">${solr.hdfs.blockcache.slab.count:1}</int>
<bool
name="solr.hdfs.blockcache.direct.memory.allocation">${solr.hdfs.blockcache.direct.memory.allocation:true}</bool>
<int
name="solr.hdfs.blockcache.blocksperbank">${solr.hdfs.blockcache.blocksperbank:16384}</int>
<bool
name="solr.hdfs.blockcache.read.enabled">${solr.hdfs.blockcache.read.enabled:true}</bool>
<bool
name="solr.hdfs.blockcache.write.enabled">${solr.hdfs.blockcache.write.enabled:true}</bool>
<bool
name="solr.hdfs.nrtcachingdirectory.enable">${solr.hdfs.nrtcachingdirectory.enable:true}</bool>
<int
name="solr.hdfs.nrtcachingdirectory.maxmergesizemb">${solr.hdfs.nrtcachingdirectory.maxmergesizemb:16}</int>
<int
name="solr.hdfs.nrtcachingdirectory.maxcachedmb">${solr.hdfs.nrtcachingdirectory.maxcachedmb:192}</int>
</directoryFactory>
The following example illustrates passing Java options by editing the /etc/default/solr or
/opt/cloudera/parcels/CDH-*/etc/default/solr configuration file:
For better performance, Cloudera recommends setting the Linux swap space on all Solr server hosts as shown
below:
# minimize swappiness
sudo sysctl vm.swappiness=10
sudo bash -c 'echo "vm.swappiness=10">> /etc/sysctl.conf'
# disable swap space until next reboot:
sudo /sbin/swapoff -a
Cloudera previously recommended a setting of 0, but in recent kernels (such as those included with RedHat 6.4
and higher, and Ubuntu 12.04 LTS and higher) a setting of 0 might lead to out of memory issues per this blog
post: http://www.percona.com/blog/2014/04/28/oom-relation-vm-swappiness0-new-kernel/.
Threads
Configure the Tomcat server to have more threads per Solr instance. Note that this is only effective if your
hardware is sufficiently powerful to accommodate the increased threads. 10,000 threads is a reasonable number
to try in many cases.
To change the maximum number of threads, add a maxThreads element to the Connector definition in the
Tomcat server's server.xml configuration file. For example, if you installed Search for CDH 5 using parcels
installation, you would modify the Connector definition in the <parcel
path>/CDH/etc/solr/tomcat-conf.dist/conf/server.xml file so this:
Becomes this:
Garbage Collection
Choose different garbage collection options for best performance in different environments. Some garbage
collection options typically chosen include:
• Concurrent low pause collector: Use this collector in most cases. This collector attempts to minimize "Stop
the World" events. Avoiding these events can reduce connection timeouts, such as with ZooKeeper, and may
improve user experience. This collector is enabled using -XX:+UseConcMarkSweepGC.
• Throughput collector: Consider this collector if raw throughput is more important than user experience. This
collector typically uses more "Stop the World" events so this may negatively affect user experience and
connection timeouts such as ZooKeeper heartbeats. This collector is enabled using -XX:+UseParallelGC.
If UseParallelGC "Stop the World" events create problems, such as ZooKeeper timeouts, consider using the
UseParNewGC collector as an alternative collector with similar throughput benefits.
You can also affect garbage collection behavior by increasing the Eden space to accommodate new objects. With
additional Eden space, garbage collection does not need to run as frequently on new objects.
Replicas
If you have sufficient additional hardware, add more replicas for a linear boost of query throughput. Note that
adding replicas may slow write performance on the first replica, but otherwise this should have minimal negative
consequences.
Shards
In some cases, oversharding can help improve performance including intake speed. If your environment includes
massively parallel hardware and you want to use these available resources, consider oversharding. You might
increase the number of replicas per host from 1 to 2 or 3. Making such changes creates complex interactions,
so you should continue to monitor your system's performance to ensure that the benefits of oversharding do
not outweigh the costs.
Commits
Changing commit values may improve performance in some situation. These changes result in tradeoffs and
may not be beneficial in all cases.
• For hard commit values, the default value of 60000 (60 seconds) is typically effective, though changing this
value to 120 seconds may improve performance in some cases. Note that setting this value to higher values,
such as 600 seconds may result in undesirable performance tradeoffs.
• Consider increasing the auto-commit value from 15000 (15 seconds) to 120000 (120 seconds).
• Enable soft commits and set the value to the largest value that meets your requirements. The default value
of 1000 (1 second) is too aggressive for some environments.
Other Resources
• General information on Solr caching is available on the SolrCaching page on the Solr Wiki.
• Information on issues that influence performance is available on the SolrPerformanceFactors page on the
Solr Wiki.
• Resource Management describes how to use Cloudera Manager to manage resources, for example with Linux
cgroups.
• For information on improving querying performance, see ImproveSearchingSpeed.
Troubleshooting
The following table contains some common troubleshooting techniques.
Note: In the URLs in the following table, you must replace entries such as <server:port> with values from
your environment. The port defaults value is 8983, but see /etc/default/solr or
/opt/cloudera/parcels/CDH-*/etc/default/solr for the port if you are in doubt.
All Varied Examine Solr log. By default, the log can be found at
/var/log/solr/solr.out.
No documents Server may not be running Browse to http://server:port/solr to see if the server
found responds. Check that cores are present. Check the
contents of cores to ensure that numDocs is more than
0.
The secure Solr This may be a version compatibility Ensure your application is using commons-codec 1.7
Server fails to issue. Httpclient 4.2.3, which or later. Alternatively, use httpclient 4.2.5 instead
respond to Solrj ships with solrj in Search 1.x, has a of version 4.2.3 in your application. Version 4.2.3
requests, but dependency on commons-codec 1.7. behaves correctly with earlier versions of
other clients If an earlier version of commons-codec.
such as curl can commons-codec is on the classpath,
communicate httpclient may be unable to
successfully communicate using Kerberos.
• Almost anything available on the admin page. Note that drilling down into the “schema browser” can be
expensive.
– FirstSearcher/NewSearcher. The solrconfig.xml file contains queries that can be fired when a new
searcher is opened (the index is updated) and when the server is first started. Particularly for
firstSearcher, it can be valuable to have a query that sorts relevant fields.
• Exceptions. The Solr log file contains a record of all exceptions thrown. Some exceptions, such as exceptions
resulting from invalid query syntax are benign, but others, such as Out Of Memory, require attention.
• Excessively large caches. The size of caches such as the filter cache are bounded by maxDoc/8. Having, for
instance, a filterCache with 10,000 entries is likely to result in Out Of Memory errors. Large caches occurring
in cases where there are many documents to index is normal and expected.
• Caches with low hit ratios, particularly filterCache. Each cache takes up some space, consuming resources.
There are several caches, each with its own hit rate.
– filterCache. This cache should have a relatively high hit ratio, typically around 80%.
– queryResultCache. This is primarily used for paging so it can have a very low hit ratio. Each entry is
quite small as it is basically composed of the raw query as a string for a key and perhaps 20-40 ints.
While useful, unless users are experiencing paging, this requires relatively little attention.
– documentCache. This cache is a bit tricky. It’s used to cache the document data (stored fields) so various
components in a request handler don’t have to re-read the data from the disk. It’s an open question how
useful it is when using MMapDirectory to access the index.
• Very deep paging. It is uncommon for user to go beyond the first page and very rare to go through 100 pages
of results. A &start=<pick your number> query indicates unusual usage that should be identified. Deep
paging may indicate some agent is completing scraping.
Note: Solr is not built to return full result sets no matter how deep. If returning the full result set
is required, explore alternatives to paging through the entire result set.
• Range queries should work on trie fields. Trie fields (numeric types) store extra information in the index
to aid in range queries. If range queries are used, it’s almost always a good idea to be using trie fields.
• fq clauses that use bare NOW. fq clauses are kept in a cache. The cache is a map from the fq clause to the
documents in your collection that satisfy that clause. Using bare NOW clauses virtually guarantees that the
entry in the filter cache is not be re-used.
• Multiple simultaneous searchers warming. This is an indication that there are excessively frequent commits
or that autowarming is taking too long. This usually indicates a misunderstanding of when you should issue
commits, often to simulate Near Real Time (NRT) processing or an indexing client is improperly completing
commits. With NRT, commits should be quite rare, and having more than one simultaneous autowarm should
not happen.
• Stored fields that are never returned (fl= clauses). Examining the queries for fl= and correlating that with
the schema can tell if stored fields that are not used are specified. This mostly wastes disk space. And fl=*
can make this ambiguous. Nevertheless, it’s worth examining.
• Indexed fields that are never searched. This is the opposite of the case where stored fields are never returned.
This is more important in that this has real RAM consequences. Examine the request handlers for “edismax”
style parsers to be certain that indexed fields are not used.
• Queried but not analyzed fields. It’s rare for a field to be queried but not analyzed in any way. Usually this is
only valuable for “string” type fields which are suitable for machine-entered data, such as part numbers
chosen from a pick-list. Data that is not analyzed should not be used for anything that humans enter.
• String fields. String fields are completely unanalyzed. Unfortunately, some people confuse string with Java’s
String type and use them for text that should be tokenized. The general expectation is that string fields
should be used sparingly. More than just a few string fields indicates a design flaw.
• Whenever the schema is changed, re-index the entire data set. Solr uses the schema to set expectations
about the index. When schemas are changed, there’s no attempt to retrofit the changes to documents that
are currently indexed, but any new documents are indexed with the new schema definition. So old and new
documents can have the same field stored in vastly different formats (for example, String and TrieDate)
making your index inconsistent. This can be detected by examining the raw index.
• Query stats can be extracted from the logs. Statistics can be monitored on live systems, but it is more common
to have log files. Here are some of the statistics you can gather:
– Longest running queries
– 0-length queries
– average/mean/min/max query times
– You can get a sense of the effects of commits on the subsequent queries over some interval (time or
number of queries) to see if commits are the cause of intermittent slowdowns
• Too-frequent commits have historically been the cause of unsatisfactory performance. This is not so important
with NRT processing, but it is valuable to consider.
• Optimizing an index, which could improve search performance before, is much less necessary now. Anecdotal
evidence indicates optimizing may help in some cases, but the general recommendation is to use
expungeDeletes, instead of committing.
– Modern Lucene code does what optimize used to do to remove deleted data from the index when
segments are merged. Think of this process as a background optimize. Note that merge policies based
on segment size can make this characterization inaccurate.
– It still may make sense to optimize a read-only index.
– Optimize is now renamed forceMerge.
embedded Solr
The ability to execute Solr commands without having a separate servlet container. Generally, use of embedded
Solr is discouraged because it is often used due to the mistaken belief that HTTP is inherently too expensive to
go fast. With Cloudera Search, and especially if the idea of some kind of MapReduce process is adopted, embedded
Solr is probably advisable.
faceting
“Counting buckets” for a query. For example, suppose the search is for the term “shoes”. You might want to
return a result that there were various different quantities, such as "X brown, Y red and Z blue shoes" that
matched the rest of the query.
replica
In SolrCloud, a complete copy of a shard. Each replica is identical, so only one replica has to be queried (per shard)
for searches.
sharding
Splitting a single logical index up into some number of sub-indexes, each of which can be hosted on a separate
machine. Solr (and especially SolrCloud) handles querying each shard and assembling the response into a single,
coherent list.
SolrCloud
ZooKeeper-enabled, fault-tolerant, distributed Solr. This is new in Solr 4.0.
SolrJ
A Java API for interacting with a Solr instance.
General
The following are general questions about Cloudera Search and the answers to those questions.
Do I need to configure Sentry restrictions for each access mode, such as for the admin console and
for the command line?
Sentry restrictions are consistently applied regardless of the way users attempt to complete actions. For example,
restricting access to data in a collection consistently restricts that access, whether queries come from the
command line, from a browser, or through the admin console.
Does Search support indexing data stored in JSON files and objects?
Yes, you can use the readJson and extractJsonPaths morphline commands that are included with the
CDK to access JSON data and files. For more information, see cdk-morphlines-json.
How can I set up Cloudera Search so that results include links back to the source that contains the
result?
You can use stored results fields to create links back to source documents. For information on data types,
including the option to set results fields as stored, see the Solr Wiki page on SchemaXml.
For example, with MapReduceIndexerTool you can take advantage of fields such as file_path. See
MapReduceIndexerTool Metadata on page 63 for more information. The output from the MapReduceIndexerTool
includes file path information that can be used to construct links to source documents.
If you use the Hue UI, you can link to data in HDFS by inserting links of the form:
<a href="/filebrowser/download/{{file_path}}?disposition=inline">Download</a>
How large of an index does Cloudera Search support per search server?
There are too many variables to provide a single answer to this question. Typically, a server can host from 10 to
300 million documents, with the underlying index as large as hundreds of gigabytes. To determine a reasonable
maximum document quantity and index size for servers in your deployment, prototype with realistic data and
queries.
Schema Management
The following are questions about schema management in Cloudera Search and the answers to those questions.
What is Apache Avro and how can I use an Avro schema for more flexible schema evolution?
To learn more about Avro and Avro schemas, see the Avro Overview page and the Avro Specification page.
To see examples of how to implement inheritance, backwards compatibility, and polymorphism with Avro, see
this InfoQ article.
Supportability
The following are questions about supportability in Cloudera Search and the answers to those questions.
Which file formats does Cloudera Search support for indexing? Does it support searching images?
Cloudera Search uses the Apache Tika library for indexing many standard document formats. In addition, Cloudera
Search supports indexing and searching Avro files and a wide variety of other file types such as log files, Hadoop
Sequence Files, and CSV files. You can add support for indexing custom file formats using a morphline command
plug-in.
In previous releases, these attributes were ignored. If init errors occur when upgrading with an existing
schema.xml, remove the default or required attributes. After removing these attributes, Search functions
as it did before upgrading.
Related JIRA: SOLR-5227.
• Indexing documents with terms that exceed Lucene's MAX_TERM_LENGTH registers errors
In previous releases, terms that exceeded the length limit were silently ignored. To make Search function as
it did in previous releases, silently ignoring longer terms, use solr.LengthFilterFactory in all of your
Analyzers.
Related JIRA: LUCENE-5472.
• The fieldType configuration docValuesFormat="Disk" is no longer supported
If your schema.xml contains fieldTypes using docValuesFormat="Disk", modify the file to remove the
docValuesFormat attribute and optimize your index to rewrite to the default codec. Make these changes
before upgrading to CDH 5.4.
Related JIRA: LUCENE-5761.
• UpdateRequestExt has been removed.
Use UpdateRequest instead.
Related JIRA: SOLR-4816.
• Parsing schema.xml registers errors when multiple values exist where only a single value is permitted.
With previous releases, when multiple values existed where only a single value was permitted, one value
was silently chosen. In CDH 5.4, if multiple values exist where only a single value is supported, configuration
parsing fails. The extra values must be removed.
Incompatible changes between Cloudera Search for CDH 5.2 and Cloudera Search for CDH 5.3
Some packaging changes were made that have consequences for CrunchIndexerTool start-up scripts. If those
startup scripts include the following line:
Incompatible changes between Cloudera Search for CDH 5 beta 2 and older versions of Cloudera Search:
The following incompatible changes occurred between Cloudera Search for CDH 5 beta 2 and older versions of
Cloudera Search including both earlier versions of Cloudera Search for CDH 5 and Cloudera Search 1.x:
• Supported values for the --reducers option of the MapReduceIndexer tool change with the release of
Search for CDH 5 beta 2. To use one reducer per output shard, 0 is used in Search 1.x and Search for CDH 5
beta 1. With the release of Search for CDH 5 beta 2, -2 is used for one reducer per output shard. Because of
this change, commands using --reducers 0 that were written for previous Search releases do not continue
to work in the same way after upgrading to Search for CDH 5 beta 2. After upgrading to Search for CDH 5
beta 2, using --reducers 0 results in an exception stating that zero is an illegal value.
For example:
inputColumn : "m:e:*"
outputField : "belongs_to_*"
belongs_to_1 : foo
belongs_to_9 : bar
• The Cloudera CDK has been updated to CDK 0.8.1. For information on changes included in this release, see
the Release Notes. This new version includes updates to Cloudera Morphlines functionality. For the latest
Cloudera CDK documentation, see Cloudera Development Kit.
• Tika has been upgraded to tika-1.4.
• Lily HBase Indexer supports Kerberos authentication. Search can use the Lily HBase Indexer to index data
stored on HBase servers that require Kerberos authentication.
• Search supports Sentry for providing authorization control. For more information, see Enabling Sentry
Authorization for Search using the Command Line on page 99.
To enable Solr ZooKeeper ACLs while retaining the existing cluster's Solr state, manually modify the existing
znode's ACL information. For example, using zookeeper-client, run the command setAcl [path]
sasl:solr:cdrwa,world:anyone:r. This grants the solr user ownership of the specified path. Run this
command for /solr and every znode under /solr except for the configuration znodes under and including
/solr/configs.
To enable Lily HBase Indexer while retaining the existing HBase-Indexer state, manually modify the existing
znode's ACL information. For example, using zookeeper-client, run the command setAcl
[path]sasl:hbase:cdrwa,world:anyone:r. This grants the hbase user ownership of every znode under
/ngdata (inclusive of /ngdata).
Note: This operation is not recursive, so creating a simple script may be helpful.
— Solr, Oozie and HttpFS fail when KMS and SSL are enabled using self-signed certificates
When the KMS service is added and SSL is enabled, Solr, Oozie and HttpFS are not automatically configured to
trust the KMS's self-signed certificate and you might see the following error.
Severity: Medium
Workaround: You must explicitly load the relevant truststore with the KMS certificate to allow these services
to communicate with the KMS.
Solr, Oozie: Add the following arguments to their environment safety valve so as to load the truststore with the
required KMS certificate.
CATALINA_OPTS="-Djavax.net.ssl.trustStore=/etc/path-to-truststore.jks
-Djavax.net.ssl.trustStorePassword=<password>"
HttpFS: Add the following arguments to the Java Configuration Options for HttpFS property.
-Djavax.net.ssl.trustStore=/etc/path-to-truststore.jks
-Djavax.net.ssl.trustStorePassword=<password>
— CrunchIndexerTool which includes Spark indexer requires specific input file format specifications
If the --input-file-format option is specified with CrunchIndexerTool then its argument must be text, avro,
or avroParquet, rather than a fully qualified class name.
— Previously deleted empty shards may reappear after restarting the leader host
It is possible to be in the process of deleting a collection when hosts are shut down. In such a case, when hosts
are restarted, some shards from the deleted collection may still exist, but be empty.
Workaround: To delete these empty shards, manually delete the folder matching the shard. On the hosts on
which the shards exist, remove folders under /var/lib/solr/ that match the collection and shard. For example,
if you had an empty shard 1 and empty shard 2 in a collection called MyCollection, you might delete all folders
matching /var/lib/solr/MyCollection{1,2}_replica*/.
— The quickstart.sh file does not validate ZooKeeper and the NameNode on some operating systems
The quickstart.sh file uses the timeout function to determine if ZooKeeper and the NameNode are available.
To ensure this check can be complete as intended, the quickstart.sh determines if the operating system on
which the script is running supports timeout. If the script detects that the operating system does not support
timeout, the script continues without checking if the NameNode and ZooKeeper are available. If your environment
is configured properly or you are using an operating system that supports timeout, this issue does not apply.
Workaround: This issue only occurs in some operating systems. If timeout is not available, a warning if displayed,
but the quickstart continues and final validation is always done by the MapReduce jobs and Solr commands
that are run by the quickstart.
— Using Solr with Sentry may consume more memory than required
The sentry-enabled solrconfig.xml.secure configuration file does not enable the hdfs global block cache.
This does not cause correctness issues, but it can greatly increase the amount of memory that solr requires.
Workaround: Enable the hdfs global block cache, by adding the following line to solrconfig.xml.secure under
the directoryFactory element:
— Solr fails to start when Trusted Realms are added for Solr into Cloudera Manager
Cloudera Manager generates name rules with spaces as a result of entries in the Trusted Realms, which do not
work with Solr. This causes Solr to not start.
Workaround: Do not use the Trusted Realm field for Solr in Cloudera Manager. To write your own name rule
mapping, add an environment variable SOLR_AUTHENTICATION_KERBEROS_NAME_RULES with the mapping. See
the Cloudera Manager Security Guide for more information.
at
org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:186)
at
org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:147)
at
org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:270)
at
org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:100)
at
com.ngdata.hbaseindexer.mr.HBaseMapReduceIndexerTool.run(HBaseMapReduceIndexerTool.java:124)
at
com.ngdata.hbaseindexer.mr.HBaseMapReduceIndexerTool.run(HBaseMapReduceIndexerTool.java:64)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at
com.ngdata.hbaseindexer.mr.HBaseMapReduceIndexerTool.main(HBaseMapReduceIndexerTool.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Workaround: Run the following command before issuing Lily HBase MapReduce jobs. Replace the .jar file names
and filepaths as appropriate.
— Users with insufficient Solr permissions may receive a "Page Loading" message from the Solr Web Admin UI
Users who are not authorized to use the Solr Admin UI are not given page explaining that access is denied, and
instead receive a web page that never finishes loading.
Workaround: None
— Some configurations for Lily HBase Indexers cannot be modified after initial creation.
Newly created Lily HBase Indexers define their configuration using the properties in
/etc/hbase-solr/conf/hbase-indexer-site.xml. Therefore, if the properties in the
hbase-indexer-site.xml file are incorrectly defined, new indexers do not work properly. Even after correcting
the contents of hbase-indexer-site.xml and restarting the indexer service, old, incorrect content persists.
This continues to create non-functioning indexers.
Workaround:
Warning: This workaround involves completing destructive operations that delete all of your other
Lily HBase Indexers.
$ /usr/lib/zookeeper/bin/zkCli.sh
[zk: localhost:2181( CONNECTED) 0] rmr /ngdata
After restarting the client services, ZooKeeper is updated with the correct information stored on the updated
clients.
— User with update access to the administrative collection can elevate the access.
Users are granted access to collections. Access to several collections can be simplified by aliasing a set of
collections. Creating an alias requires update access to the administrative collection. Any user with update
access to the administrative collection is granted query access to all collections in the resulting alias. This is
true even if the user with update access to the administrative collection otherwise would be unable to query
the other collections that have been aliased.
Workaround: None. Mitigate the risk by limiting the users with update access to the administrative collection.
— Documents may not replicate with forwarded batch update on a secure cluster.
Documents are now properly replicated on secure clusters, regardless of whether requests are forwarded from
replicas to the shard leader. In the past, on secure clusters, if a batch update request was received by a shard
replica and then forwarded to the shard leader, the request might not complete as expected.