Deploy a MemSQL cluster


memsql-deploy setup-cluster conveniently runs various memsql-toolbox-config,
memsql-deploy, and memsql-admin commands as a single command to produce a
functional MemSQL cluster that can be connected to and queried. If you would
instead like to set up a local MemSQL "cluster" for testing purposes, see
'memsql-deploy cluster-in-a-box'.

Example usages:

    memsql-deploy setup-cluster \
      --master-host host1 \
      --aggregator-hosts host2 \
      --leaf-hosts host3,host4 \
      --identity-file ~/my_key.pem \
      --license AAAAAAa/Aaa/AA== \
      --password testpass

This will install the latest released version of memsql-server on each host and
deploy a master on host1; a child aggregator on host2; and leaf nodes on host3
and host4. The hosts host1, host2... must be accessible via SSH using the
current user and the key ~/my_key.pem. A valid license and password for the
MemSQL root user are also required.

Other examples:

"High Availability" mode is enabled by default. To disable it, set
--high-availability to false:

    memsql-deploy setup-cluster --master-host host1 ... --high-availability=false

The command will deploy MemSQL on port 3306 on each node by default. To
configure it to a different port, set --memsql-port:

    memsql-deploy setup-cluster --master-host host1 ... --memsql-port 3307

If you want to install a version other than the latest released version, you can
specify a different released version, or the path to a memsql-server package:

    memsql-deploy setup-cluster --master-host host1 ... --version 6.7.0

    memsql-deploy setup-cluster --master-host host1 ... --file-path path/to/memsql-server.deb
    memsql-deploy setup-cluster --master-host host1 ... --file-path path/to/memsql-server.rpm

If you need to specify a host's SSH user or SSH port, you can add the
information to the host descriptor:

    memsql-deploy setup-cluster --master-host admin@host1:10022 --leaf-hosts admin@host2:10022,admin@host3:10022 ...

If you want to use a YAML file to define your cluster you can do so by using the
--cluster-file flag which takes in the path to a YAML file as input. Note that you have to 
give all the configurations as part of the cluster file and cannot use any other flag along
with --cluster-file. If you want to learn about creating a cluster file please 
refer to 
Usage of the command with --cluster-file flag:

    memsql-deploy setup-cluster --cluster-file path/to/cluster-file.yml

  memsql-deploy setup-cluster [flags]

      --aggregator-hosts strings               SSH addresses of the hosts to deploy child aggregators into.
      --cluster-file FILE_PATH                 Path to the cluster definition file
      --file-path ABSOLUTE_PATH                The memsql-server package to install
      --force-package-format {deb, rpm, tar}   Specify 'deb' or 'rpm' package format. Required if you have both package managers installed.
  -h, --help                                   help for setup-cluster
      --high-availability                      Whether or not to deploy the cluster in high availability mode. (default true)
      --hosts-file ABSOLUTE_PATH               A file specifying host addresses to deploy master aggregator, child aggregators, and leaves into. Expected INI format with [master], [aggregators], and [leaves] sections.
  -i, --identity-file ABSOLUTE_PATH            The identity file to SSH to each host.
      --leaf-hosts strings                     SSH addresses  of the hosts to deploy leaves into. Must have at least 1.
      --license LICENSE                        MemSQL license for the cluster.
      --master-host string                     SSH address of the host to deploy the master aggregator into.
      --memsql-port PORT                       The port each MemSQL node will run on.
      --password STRING                        Password for the MemSQL root user on each node.
      --version VERSION                        The version of memsql-server to install (default production:latest)

Global Flags:
      --cache-file FILE_PATH         File path for the Toolbox node cache
  -c, --config FILE_PATH             the Toolbox configuration file path
  -j, --json                         Enable JSON output
      --parallelism int              Maximum amount of operations to be run in parallel
      --runtime-dir DIRECTORY_PATH   where to put Toolbox runtime data
      --state-file FILE_PATH         the Toolbox state file path
  -v, --verbosity count              Increase logging verbosity: valid values are 1, 2, 3. Usage -v=Count or --verbosity=Count
  -y, --yes                          Enable non-interactive mode and assume the user would like to move forward with the proposed actions by default


This command is interactive unless you use either the --yes or --json flags to override interactive behavior.

Host file structure

For large clusters, you can specify all of your host machine SSH information through an INI file that you reference using the --host-file flag. The format is below.





The following example uses the setup-cluster command to set up a simple cluster on two different host machines using a hosts file.

hosts file



Setting up a cluster with a hosts file

memsql-deploy setup-cluster -i clusterkey --license <license> --hosts-file hosts --password SecureKey

✓ Registered hosts
memsql-deploy will perform the following actions:
  · Install memsql-server 6.7.1 on hosts
  · Deploy a master aggregator on
    - Enable high availability mode
  · Deploy a leaf node on
  · Set root password on all nodes

Would you like to continue? [y/N]: y
✓ Downloaded memsql-server 6.7.1
Installing MemSQL on all hosts...
✓ Installed memsql-server6.7.1-e823135f6e on host (1/2)
✓ Installed memsql-server6.7.1-e823135f6e on host (2/2)
✓ Successfully installed on 2 hosts
✓ Created master node
✓ Successfully set license
✓ Bootstrapped master aggregator
✓ Enabled high availability mode
✓ Created aggregator nodes
✓ Added aggregators nodes to cluster
✓ Created leaf nodes
✓ Added leaf nodes to cluster

To view your cluster, run 'memsql-admin list-nodes'
Was this article useful?