This section covers adding cluster nodes to a Squirro installation. Refer to the Setup on Linux documentation on the base installation.

Table of Contents

Overview

For background on Squirro cluster setups, refer to the How Squirro Scales document. It covers in detail what the components of Squirro are and what their scaling considerations are.

Prerequisites

Please refer to the prerequisites in the Setup on Linux document. In summary, ensure that:

Overview

Any expansion of the cluster requires some work on the old and new nodes. This is outlined in the processes below by splitting the work up into sections, based on where the work is to be executed.

The process as described here involves some cluster downtime. It is possible to expand a Squirro cluster without any downtime involved - but that process requires a bit more planning and orchestration. If you need a downtime-free expansion, contact Squirro support.

Storage Node Installation

The Squirro storage nodes are based on Elasticsearch. Some of the configuration for adding a storage node is thus in the Elasticsearch configuration files.

Process on the new server

The following process should be applied on the new storage node.

  1. Install the storage node package, as described in the section Storage Node Installation of Setup on Linux.
  2. Apply some of the configuration from the previous storage nodes to the new one. Copy over the following settings from /etc/elasticsearch/elasticsearch.yml to the new server:
  3. Allow the hosts to discover each other. Again in/etc/elasticsearch/elasticsearch.yml change the following settings:
  4. Restart the service for the settings to take effect. 

    service elasticsearch restart


  5. Setup number of shards and number of replicas

Process on all the other storage nodes

On all the previously set up storage nodes, execute these changes.

  1. Allow the hosts to discover each other. In/etc/elasticsearch/elasticsearch.yml change the following settings:
  2. Restart the service for the settings to take effect. 

    service elasticsearch restart


Cluster Node Installation

Process on the new server

The following process should be applied on the new cluster node.

  1. Install the cluster node package, as described in the section Cluster Node Installation of Setup on Linux.
  2. Stop all the services by executing the following command:

    monit -g all stop


  3. Squirro cluster service
    1. Edit the /etc/squirro/cluster.ini configuration file as follows (all settings are in the [cluster] section of the ini file):
      1. id: change this to the same value as on the previous cluster nodes - ensuring it's the same value for all cluster nodes.
      2. redis_controller: set this to true so that Redis replication is managed by the Squirro cluster service.
      3. mysql_controller: set this to true so that MySQL replication is managed by the Squirro cluster service.
    1. Turn on endpoint discovery for all Redis and database connections. This ensures that the services consult the cluster service to know which cluster node is currently the master.

      Changing this requires all the endpoint_discovery (for Redis) db_endpoint_discovery (for MySQL) configuration entries and in every /etc/squirro/*.ini file to be set to true. This can be automated with the following sed commands:

      sed -i -e 's/^endpoint_discovery = false/endpoint_discovery = true/' /etc/squirro/*.ini
      sed -i -e 's/^db_endpoint_discovery = false/db_endpoint_discovery = true/' /etc/squirro/*.ini


  4. MySQL
    1. Enable MySQL replication. This requires two changes in /etc/mysql/conf.d/replication.cnf - both of these values are commented out by default:
      1. server_id: this integer value needs to be a unique value over the whole cluster. For example use 10 for the first server in the cluster, 11 for the second, etc.
      2. report_host: set this to the human-readable name of the server, as it should be reported to the other hosts - for example node01.
    2. Raise the MySQL limits on open files and maximum connections.

      [mysqld]
      open_files_limit = 8192
      max_connections = 500

      The max_connections setting should be set higher depending on number of cluster nodes. We recommend at least 150 connections for each cluster node.

  5. Zookeeper

    1. Set the unique Zookeeper node identifier. This ID needs to start at 1, and then for each node incremented by 1. Write this identifier to /var/lib/zookeeper/data/myid.
    2. Add a list of all cluster nodes to Zookeeper. Edit /etc/zookeeper/zoo.cfg and list all the cluster nodes (including this new server):

      server.1=10.1.87.10:2888:3888
      server.2=10.1.87.11:2888:3888
      …


    3. Start Zookeeper:

      service zookeeper start


    4. At this point follow the Process on all the other cluster nodes section and make sure a cluster leader is elected.

  6. Starting
    1. Start the cluster node:

      service sqclusterd start


    2. Wait for the cluster node to come up. Make sure the election leader is the same one as on the previous nodes.

      curl -s http://127.0.0.1:81/service/cluster/v0/leader/cluster.json | python -mjson.tool | grep electionLeader

      This command may have be repeated a few times until a result is returned.
       

    3. Start all other services:

      monit -g all-active start


Process on all the other cluster nodes

This process needs to happen together with the Zookeeper configuration on the new cluster node.

  1. Add the new servers to the Zookeeper configuration. Edit /etc/zookeeper/zoo.cfg and list all the cluster nodes (including this new server):

    server.1=10.1.87.10:2888:3888
    server.2=10.1.87.11:2888:3888
    …

    This list should be identical on every cluster node.

  2. Restart Zookeeper:

    service zookeeper restart


  3. Check that the election leader points to one of the existing nodes:

    curl -s http://127.0.0.1:81/service/cluster/v0/leader/cluster.json | python -mjson.tool | grep electionLeader

    This will output a line containing the node that has currently been selected as the leader by the Squirro cluster node.

Setting up Cluster Node Storage

Some parts of Squirro require a shared file system. This is used for:

This share file system can be provided through any means, such as a NAS or an existing clustering file system.

The following instructions show how to set up such a shared file system with GlusterFS, a clustered file system.

All of the following commands - except where otherwise stated - are executed on the new node being set up.

  1. Install GlusterFS server

    yum install -y glusterfs-server
    restorecon /var/run/glusterd.socket
    service glusterd start


  2. Set up connectivity
  3. Create or extend the volume

  4. Configure the cluster storage volume to be mounted. Add the following line to /etc/fstab:

    127.0.0.1:/gv0 /mnt/gv0 glusterfs defaults 0 0


  5. Then create the mount-point and mount the new file system:

    mkdir -p /mnt/gv0
    mount /mnt/gv0


  6. Set up all the required directories in the shared file system:

    install -o sqprovid -g squirro -d /mnt/gv0/storage
    install -o sqsqirrl -g squirro -d /mnt/gv0/squirrel_log
    install -o sqplumbr -g squirro -d /mnt/gv0/pipelets
    install -o sqfile -g squirro -d /mnt/gv0/fileimport
    install -o sqfile -g squirro -d /mnt/gv0/fileimport/uploads
    install -o sqtrends -g squirro -d /mnt/gv0/trends_data
    install -o sqtopic -g squirro -d /mnt/gv0/assets
    install -o sqtopic -g squirro -d /mnt/gv0/widgets


  7. Change the configuration of the various Squirro services to point to the right folder. Below you see for each config file the desired sections and values - all the values that have been left out here should be left unmodified.

    [storage]
    default_bucket = cluster 


    [storage]
    directory = /mnt/gv0/squirrel_log/
    url_prefix = /storage/cluster/squirrel_log/


    [storage]
    directory = /mnt/gv0/pipelets/


    [topic]
    custom_assets_directory = /mnt/gv0/assets/
    custom_widgets_directory = /mnt/gv0/widgets/


    [offline_processing]
    data_directory = /mnt/gv0/trends_data


  8. Replace the previous assets and widgets folders with symlinks:

    rm -ir /var/lib/squirro/topic/assets
    rm -ir /var/lib/squirro/topic/widgets
    ln -s /mnt/gv0/assets /var/lib/squirro/topic/assets
    ln -s /mnt/gv0/widgets /var/lib/squirro/topic/widgets


  9. In the nginx config file /etc/nginx/conf.d/frontend.conf change a few of the alias declarations:
    1. Inside the location /storage/localfile/ block change the alias from its default to alias /mnt/gv0/storage/
    2. Inside the location /storage/squirrel_log block change the alias from its default to alias /mnt/gv0/squirrel_log/
    3. Verify that the configuration is still valid:

      nginx -t


    4. Reload the nginx configuration:

      service nginx reload


  10. Restart all services:

    monit -g all-active restart