SingleStore DB Server and memsqld

Overview

SingleStore DB is a distributed, relational database that runs on a set of hosts. Each host has an installation of SingleStore DB, and has one or more instances of a running memsqld process. Each memsqld processes is called a node, which can either be an aggregator or a leaf.

One set of SingleStore DB binaries can be used to run more than one node on the same host. While a single node can be deployed on a host, multiple nodes are typically deployed on hosts with multiple processors.

A collection of nodes is called a cluster, which constitutes a singular SingleStore DB database with a single point of entry.

Refer to Cluster Components for more information.

Node Configuration

During deployment, SingleStore DB server binaries are installed on each host, where the server is then used to run multiple nodes. Each node is comprised of the following core components:

  • Two instances of the primary memsqld process, one of which handles network requests (typically listening on port 3306), while the other listens on a local Unix socket

  • A few auxiliary processes, such as memsqld_safe which starts up memsqld in the event of a crash. Refer to memsqld and memsqld_safe processes for more information.

  • A memsql.cnf configuration file

The following directory structures show the locations of these components in a minimal, single-host cluster consisting of:

An aggregator node:

  • /opt/singlestoredb-server-<version>/memsqld -- or --

    /opt/memsql-server-<version>/memsqld

  • /var/lib/memsql/<aggregator-node-ID>/memsql.cnf

A leaf node:

  • /opt/singlestoredb-server-<version>/memsqld -- or --

    /opt/memsql-server-<version>/memsqld

  • /var/lib/memsql/<leaf-node-ID>/memsql.cnf

Note that this structure is equivalent for both nodes, differing only by the node ID.

SingleStore DB ensures high availability by storing redundant node data in the cluster. Should a node fail to serve its data when requested, a copy of the node's data will be served instead. This automatic failover mechanism prevents data loss due to single-node failures. Refer to High Availability for more information.

Important

The memsqld process runs under the memsql user and group on each host, which owns all of the SingleStore DB data and configuration files. This user and group are automatically created when SingleStore DB is deployed using a Debian or an RPM package. Consequently, memsqld can only be started or stopped by either the memsql user or the Linux root user (where, as root, the command is run as the memsql user).

In addition, memsqlctl, which can start or stop memsqld, must be run by either the memsql user or the Linux root user. The user and group that can run memsqld in lieu of the memsql user can be changed in the memsql.cnf file.

Finally, creating a memsql user and group manually is only recommended in a sudo-less environment when working with a tarball-based deployment of SingleStore DB.