Outdated Version

You are viewing an older version of this section. View current production version.

Deploy MemSQL min read


Info

The user that deploys MemSQL via MemSQL Toolbox must be able to SSH to each host in the cluster. When memsql-server is installed via an RPM or Debian package when deploying MemSQL, a memsql user and group are also created on each host in the cluster.

This memsql user does not have a shell, and attempting to log in or SSH as this user will fail. The user that deploys MemSQL is added to the memsql group. This group allows most Toolbox commands to run without sudo privileges, and members of this group can perform many Toolbox operations without the need to escalate to sudo. Users who desire to run MemSQL Toolbox commands must be added to the memsql group on each host in the cluster. They must also be able to SSH to each host.

Manually creating a memsql user and group is only recommended in a sudo-less environment when performing a tarball-baed deployment of MemSQL. In order to run MemSQL Toolbox commands against a cluster, this manually-created memsql user must be configured so that it can SSH to each host in the cluster.

Now you can deploy MemSQL onto each host from the main deployment host and create the MemSQL nodes for your cluster.

From the main deployment host, deploy the MemSQL on all of your hosts using the setup-cluster command. Host hosts are specified via the --master-host, --aggregator-hosts, and --leaf-hosts flags as comma-separated host names. The --password flag specifies the password for the root database user.

Other than the main deployment host being specified as the --master-host, the other hosts in your cluster can be used as hosts for the child aggregator or leaf nodes.

memsql-deploy setup-cluster -i /path/to/yourSSHkey \
    --license [YOUR LICENSE KEY] \
    --master-host <main_IP_address> \
    --aggregator-hosts <child_agg_IP_address> \
    --leaf-hosts <leaf1_IP_address>,<leaf2_IP_address> \
    --password <secure_password> \
    --version 6.7

If you are deploying in an environment with no Internet access, you must specify the absolute path to the memsql-server RPM or Debian package you downloaded in the previous step.

memsql-deploy setup-cluster -i /path/to/yourSSHkey \
    --file-path <memsql-server-package> \
    --license [YOUR LICENSE KEY] \
    --master-host <main_IP_address> \
    --aggregator-hosts <child_agg_IP_address> \
    --leaf-hosts <leaf1_IP_address>,<leaf2_IP_address> \
    --password <secure_password>

For large clusters with many hosts, it may be inconvenient to have to input all the host names in the command line. In place of the individual flags, you may instead use the --hosts-file flag with one INI file listing all the host names.

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

Warning

If your host does not have the which command available, you will need to specify the correct package through the --force-package-format {rpm|deb} flag when running the setup-cluster command.

If successful, the output should look like the following:

✓ Registered hosts
memsql-deploy will perform the following actions:
  · Install memsql-server 6.7.26 on hosts
    - 172.31.68.129
    - 172.31.78.1
    - 172.31.73.137
    - 172.31.65.62
  · Deploy a master aggregator on 172.31.68.129:3306
    - Enable high availability mode
  · Deploy a child aggregator on 172.31.78.1:3306
  · Deploy leaf nodes on
    - 172.31.73.137:3306
    - 172.31.65.62:3306
  · Set MemSQL root password on all nodes

Would you like to continue? [y/N]: y
✓ Downloaded memsql-server 6.7.26
Installing MemSQL on all hosts...
✓ Installed memsql-server6.7.26-c6e397c4a1 on host 172.31.68.129 (1/4)
✓ Installed memsql-server6.7.26-c6e397c4a1 on host 172.31.65.62 (2/4)
✓ Installed memsql-server6.7.26-c6e397c4a1 on host 172.31.78.1 (3/4)
✓ Installed memsql-server6.7.26-c6e397c4a1 on host 172.31.73.137 (4/4)
✓ Successfully installed on 4 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'

The setup-cluster command does several things for you:

  • Installs the latest memsql-server package on all hosts in your cluster.

  • Deploys MemSQL engine across all of the hosts in your cluster.

  • Creates the master aggregator. In this tutorial, the master aggregator resides on the main deployment host.

  • Creates any child aggregators specified in either the host file or in the command-line.

  • Creates leaf nodes for your cluster. Note: The setup-cluster command only creates one node per host. If your host is NUMA capable and has more than one NUMA node, you can install additional leaf nodes using the manual steps described in the Comprehensive Install Guide.

  • By default, the setup-cluster command will also enable High Availability. To disable High Availability, use the flag --high-availability=false in the setup-cluster command.

After you have deployed your cluster, run memsql-admin optimize. 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 hosts with NUMA support, this command will bind the leaf nodes to specific NUMA nodes.

memsql-admin optimize

If you encounter errors running either 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 in the setup-cluster step above.

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

    sudo apt-get install ...
    
  • Port 3306 on all hosts is open to all other hosts in the cluster.

If your environment does not meet these requirements, or if you require additional customization during the deployment process, you can deploy this same cluster using the Comprehensive Install Guide.


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

Now that your MemSQL cluster is up and running, you can connect to it using the memsql client application. Refer to memsql-client for more information.

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 MemSQL Studio.