create-node

Create a MemSQL node on the local machine.

Usage

Usage:
  memsqlctl create-node [flags]

Flags:
      --auditlogsdir ABSOLUTE_PATH       Absolute path to the auditlogs directory
      --base-install-dir ABSOLUTE_PATH   Absolute path to the base install directory
      --bind-address IPv4                the bind address
      --datadir ABSOLUTE_PATH            Absolute path to the data directory
      --disable-auto-restart             Disable automatic restarting of memsqld on error
  -h, --help                             help for create-node
      --memsql-config ABSOLUTE_PATH      Absolute path to the MemSQL config file
      --no-start                         don't start the node
  -p, --password REQUIRED_STRING         the password
      --plancachedir ABSOLUTE_PATH       Absolute path to the plancache directory
  -P, --port PORT                        the port
      --tracelogsdir ABSOLUTE_PATH       Absolute path to the 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
  -j, --json                                 Print output in JSON format
      --node-metadata-file FILE_PATH         Path to the node metadata file
      --parallelism int                      Maximum amount of operations to be run in parallel
      --ssl-ca FILE_PATH                     Path to the CA certificate file in PEM format to authenticate the MemSQL server certificate
      --timeout duration                     Maximum time for operation to complete (e.g., 30s, 10m, 1.5h)
  -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), plan cache directory (plancachedir), temporary directory (tmpdir), trace log diretory (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.

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
Was this article useful?