# `mix node`

Starts the node in distributed mode with a numbered node name schema.

Every node has a number started from 0. The name of the nodes gonna be just
simply `:node0`, `:node1`, etc.

It also tries to connect to other nodes that are already alive. For instance,
if you start `:node4` with the `node` task, it will try to connect to
`:node0`, `:node1`, `:node2`, `:node3` and also some nodes like `:node5`,
`:node6`, `:node7` and so on. That means starting `:nodeN` will try to
connect to the previous N nodes and the next N nodes. Starting `:node0` does
not trigger any connections. The `node` task uses long names.

In production you must have a more sophisticated clustering strategy, like
`libcluster`, but for development and testing the `node` task will help you
simplify your daily tasks.

## Usage:

Start an IEx shell in distributed mode with the name `node4`:

```bash
  $ iex -S mix node 4
```

Start node number 3 without the IEx shell:

```bash
  $ mix node 3
```

It is also possible to start nodes without manually entering numbers for them.
Use an underscore `_` in place of the node number and the node task will find
you the first available node number starting from 1:

```bash
  $ iex -S mix node _
```

You can use an underscore to start a node without specifying the node number.
In that case the task is going to figure out the smallest available node number
and use that number.

It is also possible to add further Mix tasks to the command line.

# `node_name`

Returns the node name of the `n`th node.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
