Tutorial 3 - Creating clusters

Before you begin

Make sure you have worked through Tutorial 1 - Creating nodes and Tutorial 2 - Naming nodes.

About this task

Nodes create clusters by contacting each other. The contact nodes available are collected from the first of the listed sources that is available:

  1. A sys.config file that already exists before the node is created.
  2. A command-line argument. See Step 2.
  3. An environment variable. See Tip on environment variables.
  4. Default value, the node contacts the oldest running node.
  5. Default value, the node contacts itself.
Important: If SPARKL finds a sys.config file in the directory before creating a node there, SPARKL does not generate the license file, the configuration database and the logs directory. Therefore, it is recommended to let SPARKL create the sys.config during auto-configuration, and edit this file later on, if necessary.

Procedure

  1. Create a new directory and name it four@sparkl.com.
  2. When creating a node in this directory, use the -contact argument to make this node contact itself.
    (cd four@sparkl.com && sse start -contact four@sparkl.com)
    Tip: You can also use Linux environment variables to create clusters. For example: export CONTACT=four@sparkl.com.
    Important: If you give your nodes a host name that is different from your machine's host name, be sure to use the -contact argument when creating clusters, otherwise the newly-created nodes cannot find the contact node. By default, the auto-configuration assumes that all nodes' host name is the same as your machine's host name.
  3. Create a new directory and name it five@sparkl.com.
  4. When creating node five@sparkl.com, use the -contact argument to make it join four@sparkl.com in a cluster.
    (cd five@sparkl.com && sse start -contact four@sparkl.com)
    Tip: To check which node your node contacts, look at the sys.config of your node.
  5. Create another directory and name it six.
  6. Create a node in the directory, name it 6@sparkl.com, and make it join the same cluster formed by four@sparkl.com and five@sparkl.com.
    (cd six && sse start -node 6@sparkl.com -contact four@sparkl.com)

Results

If you have worked through this tutorial, you should have six nodes separated into two clusters, as listed in Table 1.
Table 1. Running SPARKL tutorial - Node clusters
Directory name Node name Contact node
one one@[machinehost].local one@[machinehost].local
two@127.0.0.1 two@127.0.0.1 one@[machinehost].local
three 3@127.0.0.1 one@[machinehost].local
four@sparkl.com four@sparkl.com four@sparkl.com
five@sparkl.com five@sparkl.com four@sparkl.com
six 6@sparkl.com four@sparkl.com

Note that only one node can open any given port, such as 8000. When you connect the Developer Console to that port, you will be managing the cluster of which that node is a member.

To connect the Developer Console to a different node, perhaps in a different cluster, you need to edit the sys.config to use a different port - for example, 8001.