SearchBlox

SearchBlox Developer Documentation

Welcome to the SearchBlox developer documentation. Here you will find comprehensive technical documentation to help you start working with SearchBlox as quickly as possible, as well as support if you get stuck. Let's jump right in!

Guides

Cluster Setup

Please setup the 3 individual SearchBlox Servers and apply the license keys to all servers before proceeding with the cluster setup instructions.

SearchBlox Cluster Setup

Cluster set up can be done directly from the SearchBlox Admin Console. We recommend 3 SearchBlox Servers ( 1 Index and 2 Search servers) for the cluster setup.

Setup SearchBlox 3 Server Cluster

  1. Install SearchBlox on three different physical or virtual servers and apply server license keys.

  2. Confirm that the three servers can see each other on the network, i.e., you should be able to ping the other servers using their IP.

  3. Delete all existing collections in all three servers before configuring the cluster setup.

  4. Upload server licenses in all three servers.

  5. Edit the file <SEARCHBLOX_INSTALLATION_PATH>/webapps/searchblox/WEB-INF/searchblox.yml in all 3 servers:

searchblox.shards: 1
searchblox.replicas: 0

please change to the following values and save the file:

searchblox.shards: 1
searchblox.replicas: 1

  1. Restart the Indexing and Search Servers.

❗️

Network traffic access between the 3 servers need to be allowed

  • Port 9200 and 9300 should be accessible on all three servers.
  • Traffic must be allowed on ports 9200 and 9300 among these 3 servers.
  • All traffic needs to be open among the servers within cluster without any firewall restrictions.

Configure Cluster Setup in SearchBlox Admin Console

  1. Go to Menu -> Admin -> Cluster for every server in the cluster as shown below:
  1. Select Multi-Node as in the screenshot below:
  1. Select one server for the Index server and remaining 2 other servers as Search servers

  2. Add the IP addresses for servers that have to join the cluster, including the current server.

Indexing Server:
Enter the IP address of the server, which is to be the Index server.

Search Server:
Enter the IP addresses of the servers, which are to be the Search servers.

Cluster name: (Optional)
If required, you can provide a unique cluster name for your search cluster setup. Please give the same cluster name for all the servers within the same cluster to enable them to identify and join together.

  1. Stop all SearchBlox servers

  2. Delete the folder called node within <SEARCHBLOX_INSTALLATION_PATH>/elasticsearch/data path

  3. Start the SearchBlox servers in the cluster starting with the index server followed by the 2 search servers.

  4. Login to the Index server, create a new collection and start indexing the collection. The new collection will now be available on the 2 other search servers within a few minutes if the setup is successful.

Continue with the following troubleshooting steps if the new collection is not shown on the search servers

  1. Run the following command on all servers to check the cluster status:
    curl -XGET 'https://<IP>:9200/_cluster/health?pretty=true'

The url can also be accessed at https://:9200/_cluster/health?pretty=true

  1. The cluster health status needs to be green or yellow

  2. The number_of_nodes has to be 3 for a three server cluster setup. If the number_of_nodes is 3 and the cluster health is green or yellow, then the setup is successful.

  3. Create more collections on the indexing server, the same collections will automatically get created in search servers. Start the indexing on the Index server, and see if the search results show up on the search servers for the same collection.

❗️

Restart Servers after Cluster setup changes

Please restart all servers after adding the cluster nodes and/or changing the cluster name.

Indexing and Searching in Cluster Setup

  • Indexing is only allowed on the Index server.
  • Search is possible from both Index and Search servers.
  • If the Index server goes down, searching is still possible through search servers until the indexing node recovers.
  • If a search server goes down, indexing and searching are possible through other servers. When the failed search server comes up, the indexed data will be replicated and be in sync.

Set up Analytics for Cluster

Analytics server will use SQLITE by default for the standalone server. For a cluster, you will need to setup an external database using Postgres so search analytics will be stored in a central database.

Setup a centralized Analytics database with the following steps:

  1. Download and install Postgres. You can download Postgres from the official site https://www.postgresql.org/download/

  2. Create a new database called sbanalytics within Postgres

  3. Provide the details of the analytics database in .../webapps/searchblox/WEB-INF/searchblox.yml in all 3 cluster servers. This configuration will log the user search queries into this central database.

Format:
analytics.db.type: postgres
analytics.db.url: {IP/HOST}:{PORT}
analytics.db.username: {POSTGRES_USERNAME}
analytics.db.pasword: {POSTGRES_PASSWORD}
analytics.db.name: {DATABASE_NAME}

Example:
analytics.db.type: postgres
analytics.db.url: 1.1.1.1:5432
analytics.db.username: sb_analytics_user
analytics.db.pasword: password12345
analytics.db.name: sbanalytics

  1. Update <SEARCHBLOX_INSTALLATION_PATH>/analytics/.env in all 3 servers to update the connection information to your database.

Example:
CUBEJS_DB_HOST=1.1.11.1
CUBEJS_DB_NAME= sbanalytics
CUBEJS_DB_USER=sb_analytics_user
CUBEJS_DB_PASS=password12345
CUBEJS_WEB_SOCKETS=true
CUBEJS_DB_TYPE=postgres

  1. Restart SearchBlox servers. You can restart the Index server followed by the 2 Search servers.

  2. Restart Analytics server and try test searches from Search servers to see the queries being logged in the database. You will see 3 tables within the database - autosuggest_click_logs, click_logs, query_logs.

Upgrade Cluster

A clean installation to cluster similar to standalone servers is recommended.

Best Practices for Cluster Setup

  • Load balancer needs to be setup to distribute the load between search servers.
  • Ensure that Index and Search servers are able to connect with each other on the same network.
  • Port 9200 and 9300 should be open across all the three servers. Traffic must be allowed on ports 9200 and 9300 among these 3 servers.
  • Elasticsearch URLs should be accessible across all three servers

Updated 15 days ago


What's Next

You can go through the related sections below

Setting up HAProxy for Cluster Setup

Cluster Setup


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.