create-node

Description

Create a node on the host.

The create-node command will create a node on the host by creating its config file and associated data directories on the host's filesystem. It will also start the node by default.

Examples

memsqlctl create-node --password 'TEST_PASSWORD'

This will create a node with its files in the default installation directory. The node will also be started and the database root password will be set to TEST_PASSWORD.

The database password may also be set in the MEMSQL_PASSWORD environment variable in lieu of using the --password flag.

The --password flag must be specified if the node will be started, but it may be set to the empty string (equivalent to no password) for convenience in demo or testing situations:

memsqlctl create-node --password ""

Use the --no-start option to create the node's directories and data on the filesystem without starting the node:

memsqlctl create-node --no-start

Note that you must not specify a password when using the --no-start option as the node's database root password will not be set. Run memsqlctl change-root-password to set it.

To configure the port (default 3306):

memsqlctl create-node ... --port 3307

By default the node's data and directories will be rooted in a base install directory (named a randomly-generated UUID) which is in the default install directory. To find out where the default install directory is, run memsqlctl env.

Note that the singlestoredb-server .rpm and .deb packages configure the default install directory to be /var/lib/memsql. If you want to change the location of the node's base install directory:

memsqlctl create-node ... --base-install-dir /memsql_node_1

This will lay out all of the node's data and directories in /memsql_node_1. The filesystem will resemble:

/memsql_node_1
memsql.cnf
data/
auditlogs/
plancache/
tracelogs/

If you want to change the location of only one directory and leave the rest in a directory rooted in the default install directory:

memsqlctl create-node ... --datadir /data/memsql_node_1/data

The filesystem will resemble:

{default install dir}
{base dir}
memsql.cnf
auditlogs/
plancache/
tracelogs/
/data/memsql_node_1
data/

Usage

Usage:
memsqlctl create-node [flags]
Flags:
--allow-ipv6 Allow IPv6 connections
--auditlogsdir ABSOLUTE_PATH Absolute path to the auditlogs directory
--base-install-dir ABSOLUTE_PATH Absolute path to the base install directory
--bind-address IP The bind address
--datadir ABSOLUTE_PATH Absolute path to the data directory
--disable-auto-restart Disable automatic restart of memsqld on error
-h, --help Help for create-node
--memsql-config ABSOLUTE_PATH Absolute path to the node config file
--no-start Do not start the node
-p, --password STRING The password
--plancachedir ABSOLUTE_PATH Absolute path to the plancache directory
-P, --port PORT The port
--ssl-fips-mode string Whether the node operates in OpenSSL/FIPS mode
--tracelogsdir ABSOLUTE_PATH Absolute path to the tracelogs directory
Global Flags:
-c, --config FILE_PATH Path to the memsqctl config file
--default-install-dir DIRECTORY_PATH Path to the default install directory
--insecure-ssl Fall back to insecure SSL connections to local SingleStore nodes if memsqlctl is unable to otherwise establish a connection (ADVANCED)
-j, --json Print output in JSON format
--node-metadata-file FILE_PATH Path to the node metadata file
--parallelism POSITIVE_INTEGER Maximum amount of operations to be run in parallel
--ssl-ca FILE_PATH The path to the CA certificate file (in PEM format) to authenticate the database certificate
--timeout duration Maximum time for operation to complete (e.g., 30s, 10m, 1.5h)
--verbose-json Print output in JSON format, include some warnings and user messages
-v, --verbosity count Increase logging verbosity
-y, --yes Enable non-interactive mode and assume the user would like to move forward with the proposed actions by default

Remarks

  • This command will create a new memsql.cnf file (if one does not already exist) for the node and populate it with paths for the data directory (datadir), plancache directory (plancachedir), temporary directory (tmpdir), trace log directory (tracelogsdir), and audit log directory (auditlogsdir). For each of these directory paths, if the directory does not exist, memsqlctl will create the directory. The owner for each directory is the current user with the permissions set to 755.

    Next, memsqlctl will add a record of the node (its path to memsql.cnf) to the node metadata file, nodes.hcl.

  • If --base-install-dir is specified, all of the other directories (data, tracelogs, etc) will be placed in that directory by default. To install a node into a particular directory, run create-node --base-install-dir /my/dir. Specifying values for --datadir, --tracelogsdir, etc. allow you to put those particular directory somewhere else, but all directories you don’t specify will go into the directory specified by --base-install-dir.

  • If --base-install-dir is not specified, memsqlctl sets the base install directory to a subdirectory of --default-install-dir. The --default-install-dir flag can be specified as a global flag, but would more likely be specified in the global memsqlctl configuration file which is at /etc/memsql/memsqlctl.hcl by default. If you set --default-install-dir, then by default, all created nodes will go into that directory. When creating a node in the --default-install-dir, memsqlctl will create a subdirectory with a random UUID name to differentiate it from other nodes on the same host. So the default base directory of a new node will be something like /var/lib/memsql/2de7ec03-93c3-4f90-837b-65aaa769034d. /var/lib/memsql is the default value of --default-install-dir.

  • The --password flag specifies the SingleStoreroot password for the node being created; it is required unless you use the --no-start flag. You can optionally use the --password flag in conjunction with the --user flag to specify a SingleStore user that is different from the root user and the user’s password. Note that the MEMSQL_PASSWORD environment variable is a safer alternative option for setting the password.

  • Wrap the password string in single quotes (') to avoid having the shell try to interpret any special characters included in the string.

  • If --password is specified by the user, memsqlctl will connect to the node and run the necessary GRANT… SQL commands to set a password for the root user. The encrypted password will be added to nodes.hcl.

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

  • The memsqlctl create-node command is equivalent to the sdb-admin create-node command.

Output

The following is the standard output for the create-node command. Also, if you want to create more than one node per host, you must set --port to a unique value for each new subsequent node.

sudo memsqlctl create-node
memsqlctl will perform the following actions:
  · Create node on port 3307
    - Base directory = /var/lib/memsql/e3f3bceb-a714-421d-8451-905e1d35684a
    - Config file = /var/lib/memsql/e3f3bceb-a714-421d-8451-905e1d35684a/memsql.cnf

  · Set up runtime environment

  · Start node

Would you like to continue? [y/N]: y
✓ Created node with MemSQL ID 994274A024996ADAD6B1B780352C0EDBC0E7328F
✓ Set up runtime environment
✓ Started node with MemSQL ID 994274A024996ADAD6B1B780352C0EDBC0E7328F

Last modified: April 25, 2023

Was this article helpful?