1.8. Search Plugin Installation

New in version 3.0.

CouchDB can build and query full-text search indexes using an external Java service that embeds Apache Lucene. Typically, this service is installed on the same host as CouchDB and communicates with it over the loopback network.

The search plugin is runtime-compatible with Java JDKs 6, 7 and 8. Building a release from source requires JDK 6.

1.8.1. Installation of Binary Packages

Binary packages that bundle all the necessary dependencies of the search plugin are available on GitHub. The files in each release should be unpacked into a directory on the Java classpath. The service expects to find a couple of configuration files conventionally called clouseau.ini and log4j.properties with the following content:

clouseau.ini:

[clouseau]

; the name of the Erlang node created by the service, leave this unchanged
name=[email protected]

; set this to the same distributed Erlang cookie used by the CouchDB nodes
cookie=monster

; the path where you would like to store the search index files
dir=/path/to/index/storage

; the number of search indexes that can be open simultaneously
max_indexes_open=500

log4j.properties:

log4j.rootLogger=debug, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %c [%p] %m%n

Once these files are in place the service can be started with an invocation like the following:

java -server \
     -Xmx2G \
     -Dsun.net.inetaddr.ttl=30 \
     -Dsun.net.inetaddr.negative.ttl=30 \
     -Dlog4j.configuration=file:/path/to/log4j.properties \
     -XX:OnOutOfMemoryError=\"kill -9 %p\" \
     -XX:+UseConcMarkSweepGC \
     -XX:+CMSParallelRemarkEnabled \
     com.cloudant.clouseau.Main \
     /path/to/clouseau.ini

1.8.2. Chef

The CouchDB cookbook can build the search plugin from source and install it on a server alongside CouchDB.

1.8.3. Kubernetes

Users running CouchDB on Kubernetes via the Helm chart can add the search service to each CouchDB Pod by setting enableSearch: true in the chart values.

1.8.4. Additional Details

The Search User Guide provides detailed information on creating and querying full-text indexes using this plugin.

The source code for the plugin and additional configuration documentation is available on GitHub at https://github.com/cloudant-labs/clouseau.