Outdated Version

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

create-node

Info

MemSQL Helios does not support this command.

Create a node on the host.

Usage

Create a node on the host

'memsqlctl create-node' 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.

Example usages:

    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 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 dir.
To find out where the default install dir is, run "memsqlctl env".
Note that the memsql-server rpm and deb packages configure the default install
dir to be /var/lib/memsql.

If you want to change the location of the node's base install dir:

    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 dir:

    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:
  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 SingleStoreDB 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

memsqlctl will create (if one does not already exist) a new memsql.cnf file 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. So 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 machine. 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.

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 the --yes or --json flags 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 machine, 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