You are viewing a beta version of this section. View current production version.

Deploy MemSQL min read

Now that the MemSQL tools are installed, you can deploy MemSQL onto each host machine from the main deployment machine and create the MemSQL nodes for your cluster.

  1. When deploying a cluster through the manual steps in this guide, you must register all host machines used in cluster deployment. Start by logging into the main deployment machine over SSH.

  2. Once connected, register the host machine. Host names must be unique across the cluster, so the IP address of the host will be used in this tutorial.

    memsql-toolbox-config register-host --localhost --host <IP_address>

    Note: If a DNS name or IP address is not provided as a host name, then you must specify the ssh address using the --ssh flag. Also, because this host machine is local to the memsql-toolbox-config tool, you must use the --localhost flag.

  3. Repeat this step for the other host machines in the cluster.

    memsql-toolbox-config register-host --identity-file </ssh_key_file/including/path> --host <IP_address>
  4. Verify all hosts have been added.

    memsql-toolbox-config list-hosts
  5. Install MemSQL on all of your host machines. If you are deploying in an environment with no Internet access, specify the absolute path to the memsql-server RPM or Debian package you downloaded previously.

    Note: If your host machine does not have the which command available, follow the offline installation method using a downloaded memsql-server RPM or Debian package.

    Online access to APT or YUM repositories

    memsql-deploy install --all --version 7.0

    Offline deployment or no which command available

    memsql-deploy install --file-path /tmp/<memsql-server-package> --all

    MemSQL will be copied onto each machine. The time for this process is directly dependent upon the size of your cluster.

  6. Create a new node. This node will be the master aggregator for the cluster. Change <IP_address> to match IP address of the main deployment machine. For security purposes, you must set a database password for the root user. This can be passed in as a plaintext string or through the MEMSQL_PASSWORD environment variable.

    memsql-admin create-node --host <IP_address> --password <secure_password>
  7. From the output of the create-node command, copy the MemSQL ID of your recently-created node. You will need this for the next two steps.

  8. Assign the node the role of master aggregator and set the cluster license.

    memsql-admin bootstrap-aggregator --memsql-id <MemSQL_ID> --license [YOUR LICENSE KEY]

    Note: If your license key is not shown in the code block above, you can retrieve it from the MemSQL Customer Portal.


    After the master aggregator node is deployed, it must be bootstrapped by adding this license for the cluster. This step must be completed before deploying additional nodes.

    If you skip this step and attempt to deploy additional nodes, an error will occur and the deployment will fail.

  9. Create another MemSQL node. Change <IP_address> to match the value specified on one of your remaining host machines and set the secure password for the root database user.

    memsql-admin create-node --host <IP_address> --password <secure_password>
  10. As you did in Step 7, copy the MemSQL ID of your recently-created node from the output of the create-node command.

  11. Assign this “unknown” node the role of “aggregator” to designate it as a child aggregator.

    memsql-admin add-aggregator --memsql-id <MemSQL_ID> --password <secure_password>
  12. Create two more MemSQL nodes. Change <IP_address> to match the values for the last two host machines and set the secure password for the root database user.

    Note: If the host machines for your leaf nodes are NUMA capable, follow the steps here to setup the host machines correctly and then repeat this node creation step for every NUMA node on those host machines. The default port is 3306, so you will have to increment that value for each node you add on the same host machine as well as expose those ports to the other machines in the cluster.

    memsql-admin create-node --host <IP_address> --password <secure_password>
  13. Retrieve the ID values for each of the new nodes. They will be listed as “unknown” in the output.

    memsql-admin list-nodes
  14. Run the following command on each of the remaining nodes to assign them as leaf nodes.

    memsql-admin add-leaf --memsql-id <MemSQL_ID> --password <secure_password>
  15. Analyze your current cluster configuration using the optimize command. This command checks your current cluster configuration against a set of best practices and either makes changes to maximize performance or provides recommendations for you. For host machines with NUMA support, this command will bind the leaf nodes to specific NUMA nodes.

    memsql-admin optimize

If you encounter errors running any of these commands, verify that your deployment environment satisfies the following conditions:

  • You can SSH to every host in the cluster using the IPs specified above.

  • Your deployment user has root or sudo privileges in order to install packages on all hosts:

    sudo apt-get install ...
  • MemSQL ports on all hosts are open to all other hosts in the cluster.

Congratulations! Your MemSQL cluster is now setup and ready to use.

You can connect to your cluster using the memsql client application by simply typing memsql in a terminal window on the main deployment machine.

In addition, you can use MemSQL Studio to easily monitor, debug, and interact with all of your MemSQL clusters. See the next step for how to connect and use Studio.

Was this article useful?