create-node

Description

Create a SingleStore node on a specific host.

Before running this command, SingleStore must be installed on the host. Use sdb-deploy install to install SingleStore on the host.

The --password flag specifies the SingleStoreroot password for the node being created; it is required unless you use the --no-start flag. You can 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.

The create-node command will create a SingleStore node on a registered host by creating its config file and associated data directories on the filesystem.

This command will also start the node by default. If you are managing the node state with systemd (via sdb-systemd-client), consider running this command with the --no-start flag, and then start the node using sdb-admin start-node or sdb-admin restart-node commands.

Examples

sdb-admin create-node --host host1 --password TEST_PASSWORD

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

If you do not want to use the --password flag to pass in the database root password you may also set the environment variable MEMSQL_PASSWORD.

The --password option 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:

sdb-admin create-node --host host1 --password ""

If you only want to lay out the node's data and directories on the filesystem but do not want to start the process, use the --no-start flag:

sdb-admin create-node --host host1 --no-start

Note that you must not specify a password with the --no-start flag and thus, when the node is eventually started, its SingleStore root password will not be set. You must run sdb-admin change-root-password to set it.

To configure the port (default 3306):

sdb-admin create-node --host host1 --password TEST_PASSWORD --port 3307

By default, the node's data and directories will be rooted in a base install directory (named via randomly generated UUID) which is in the default install directory. To find out where the default install directory is on host1, run memsqlctl env on host1. Note that the singlestoredb-server.rpm and .deb packages configure the default install dir to be /var/lib/memsql.

If you want to change where the node's base install directory is on host1:

sdb-admin create-node --host host1 --password TEST_PASSWORD --base-install-dir /memsql_node_1

This will lay out all of the node's data and directories on host1 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 on host1:

sdb-admin create-node --host host1 --password TEST_PASSWORD --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/

In addition, the --role option can be used to assign a role to the node after creation. Possible roles are leaf, aggregator, and master.

To create an aggregator node:

sdb-admin create-node --host host1 --password TEST_PASSWORD --role aggregator

Some additional flags can be used to set role-specific options. For example, the role of master requires a license to be provided or the MEMSQL_LICENSE environment variable to be set:

sdb-admin create-node --host host1 --password TEST_PASSWORD --role master --license your_license

The --set-configs option can be used to set configuration variables before starting the node. Only those variables that can be set on startup are permitted:

sdb-admin create-node --host host1 --password TEST_PASSWORD --port 3307 --role leaf \
--set-configs http_api=ON,max_connection_threads=200

Usage

Usage:
  sdb-admin create-node [flags]

  For flags that can accept multiple values (indicated by VALUES after the name of the flag),
  separate each value with a comma.

Flags:
      --allow-ipv6                                 Allow the node to use IPv6
      --auditlogsdir STRING                        Absolute path to the auditlogs dir on the target host
      --availability-group INT                     Availability group to assign to the leaf node
      --base-install-dir STRING                    Absolute path to the base install directory on the target host
      --bind-address STRING                        The bind address
      --datadir STRING                             Absolute path to the data dir on the target host
      --disable-auto-restart                       Disable automatic restarting of memsqld on error
      --force-master                               Force-assigns the role of master, even if a master exists
  -h, --help                                       Help for create-node
      --host string                                Where to create the node
      --license LICENSE                            License to apply to the master node
      --memsql-config STRING                       Absolute path to the node config file path on the target host
      --no-start                                   Do not start the node
  -p, --password STRING                            The database user's password. If a password is specified on the command line, it must not contain an unescaped '$' character as it will be replaced by the shell.
                                                   If a password is not specified on the command line and --no-start is not set, Toolbox will attempt to read the password from the ‘MEMSQL_PASSWORD’ environment variable.
                                                   If this variable is present but does not contain a value, or if the variable does not exist, Toolbox will prompt for a password
      --plancachedir STRING                        Absolute path to the plancache dir on the target host
  -P, --port PORT                                  The port
      --role {master, aggregator, leaf, unknown}   Role that a node will be assigned when created. Possible roles are LEAF, AGGREGATOR, and MASTER (default Unspecified)
      --set-configs key=value                      Set configuration variables for the node. Only those variables that can be set on startup are permitted. For example: --set-configs http_api=ON,max_connection_threads=200 (ADVANCED)
      --ssl-fips-mode string                       Whether the node operates in OpenSSL/FIPS mode
      --tracelogsdir STRING                        Absolute path to the tracelogs dir on the target host
      --user STRING                                The database user for setting a role
      --user-password STRING                       The database user's password for setting the role. If a password is specified on the command line, it must not contain an unescaped '$' character as it will be replaced by the shell

Global Flags:
      --backup-cache FILE_PATH                File path for the backup cache
      --cache-file FILE_PATH                  File path for the Toolbox node cache
  -c, --config FILE_PATH                      File path for the Toolbox configuration
      --disable-colors                        Disable color output in console, which some terminal sessions/environments may have difficulty with
      --disable-spinner                       Disable the progress spinner, which some terminal sessions/environments may have issues with
  -j, --json                                  Enable JSON output
      --parallelism POSITIVE_INTEGER          Maximum number of operations to run in parallel
      --runtime-dir DIRECTORY_PATH            Where to store Toolbox runtime data
      --ssh-control-persist SECONDS           Enable SSH ControlPersist and set it to the specified duration in seconds
      --ssh-max-sessions POSITIVE_INTEGER     Maximum number of SSH sessions to open per host, must be at least 3
      --ssh-strict-host-key-checking          Enable strict host key checking for SSH connections
      --ssh-user-known-hosts-file FILE_PATH   Path to the user known_hosts file for SSH connections. If not set, /dev/null will be used
      --state-file FILE_PATH                  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

Remarks

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

Last modified: October 6, 2023

Was this article helpful?