Connect Bouquet server to an external elasticsearch engine

By default, Bouquet server launches an internal Elasticsearch node to index facets. But this is generally used for development and tests purpose only.

This article explains how to connect Bouquet server to an external Elasticsearch engine.

Requirements

  • You have installed Bouquet Server
  • You have an elasticsearch node or cluster running and accessible from the Bouquet server

 This guide is composed of four steps:

  1. Reconfigure bouquet.xml file
  2. Create elasticsearch.yml file
  3. Reconfigure tomcat running configuration
  4. Restart tomcat

 

 Reconfigure bouquet.xml

In /opt/squid/bouquet/etc/bouquet.xml, add this XML entry:

<entry key="elastic.local">false</entry>

Create elasticsearch.yml file

Create the file elasticsearch.yml in the /opt/squid/bouquet/etc directory with this content:

################################### Cluster ###################################

# Cluster name identifies your cluster for auto-discovery. If you're running
# multiple clusters on the same network, make sure you're using unique names.
#
cluster.name: "MY_CLUSTER"
#################################### Node #####################################

# Node names are generated dynamically on startup, so you're relieved
# from configuring them manually. You can tie this node to a specific name:
#
node.name: "bouquet"

node.master: false
node.data: false
path.data: ${CATALINA_BASE}/caches
transport.tcp.port: 9350-9400
http.enabled: false

# Set to ensure a node sees N other master eligible nodes to be considered
# operational within the cluster. This should be set to a quorum/majority of 
# the master-eligible nodes in the cluster.
#
discovery.zen.minimum_master_nodes: X

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["addr1:port1","addr2:port2"]

Reconfigure tomcat running configuration

You need to specify where the elasticsearch.yml file is located.

Edit the JAVA_OPTS tomcat environment variable:

  • /etc/default/tomcat7 on Ubuntu
    JAVA_OPTS="${JAVA_OPTS} -Des.default.path.conf=/opt/squid/bouquet/etc -DDEBUG.MONGO=true -DDB.TRACE=true \
    -Dlogback.configurationFile=logback.xml -Duser.timezone=UTC \
    -Dkraken.cache.config.json=/opt/squid/bouquet/etc/cache.json -Dkraken.facet=front,keyserver,queries,queryworker \
    -Dkraken.config.file=/opt/squid/bouquet/etc/bouquet.xml \
    -Dkraken.plugin.dir=/opt/squid/bouquet/plugins"
  • /etc/tomcat/tomcat.conf on CentOS
    JAVA_OPTS="-Des.default.path.conf=/opt/squid/bouquet/etc -DDEBUG.MONGO=true -DDB.TRACE=true \
    -Dlogback.configurationFile=logback.xml -Duser.timezone=UTC \
    -Dkraken.cache.config.json=/opt/squid/bouquet/etc/cache.json -Dkraken.facet=front,keyserver,queries,queryworker \
    -Dkraken.config.file=/opt/squid/bouquet/etc/bouquet.xml \
    -Dkraken.plugin.dir=/opt/squid/bouquet/plugins"

The difference between this configuration and the one we covered here is that es.path.data and es.network.bind_host have been replaced by es.default.path.conf.

Restart tomcat

Now the Elasticsearch code is able to search for elasticsearch.yml in the /opt/squid/bouquet/etc directory. But make sure that there's no elasticsearch.yml file in your current directory before restarting tomcat, because Elasticsearch's JAR will read this one before!

  • On Ubuntu
service tomcat7 restart
  • On Centos 6
/etc/init.d/tomcat restart
  • On Centos 7
systemctl restart tomcat
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.