# delete-node

## Description

Completely removes a node and its data from the cluster.

Note that this action is only reversible by deploying a new leaf in the same location, attaching it, and rebalancing partitions.

This command removes the specified node from the cluster and deletes its data. If the node is a leaf node, this command will also rebalance the leaf node’s partitions into the remaining cluster.

A node must be stopped before it can be deleted. Use the [stop-node](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/memsqlctl-commands/stop-node.md) command to perform this action.

If `--memsql-id`, or `--memsql-cnf`, or `--all` is not specified, `memsqlctl` will prompt the user to select a node from a table.

If `--memsql-cnf` is specified, `memsqlctl` will attempt to first delete the specifieddirectories in the config (`datadir`, `plancachedir`, `tracelogsdir`, etc.). Finally, `memsqlctl` will delete the `memsql.cnf` file itself and its record in the node metadata file, `nodes.hcl`.

To remove a leaf node from the cluster without deleting its data, and with the ability to add it back to the cluster, refer to the [memsqlctl remove-leaf](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/memsqlctl-commands/remove-leaf.md) command.

## Usage

```
Usage:
  memsqlctl delete-node [flags]

Flags:
  -a, --all                 Delete all nodes on the host
  -h, --help                Help for delete-node
      --memsql-id strings   the node ID of the node to delete
      --stop                Stop each node before deletion

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 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 is interactive unless you use either `--yes` or `--json` flag to override interactive behavior.
* The `memsqlctl delete-node` command is equivalent to the [sdb-admin delete-node](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/delete-node.md) command.

## Output

The following is the standard output for the `delete-node` command.

```shell
sudo memsqlctl delete-node

```

```output

memsqlctl will perform the following actions:
  · Delete SingleStore node
    - Base directory and contents: /var/lib/memsql/61cbf018-4256-4c43-82a7-530220e5817b

Would you like to continue? [y/N]: y
✓ Deleted node defined by MemSQL config file /var/lib/memsql/61cbf018-4256-4c43-82a7-530220e5817b/memsql.cnf

```

***

Modified at: April 22, 2024

Source: [/db/v9.1/reference/singlestore-tools-reference/memsqlctl-commands/delete-node/](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/memsqlctl-commands/delete-node/)

(An index of the documentation is available at /llms.txt)
