[[modules-gateway-local]]
=== Local Gateway

The local gateway allows for recovery of the full cluster state and
indices from the local storage of each node, and does not require a
common node level shared storage.

Note, different from shared gateway types, the persistency to the local
gateway is *not* done in an async manner. Once an operation is
performed, the data is there for the local gateway to recover it in case
of full cluster failure.

It is important to configure the `gateway.recover_after_nodes` setting
to include most of the expected nodes to be started after a full cluster
restart. This will insure that the latest cluster state is recovered.
For example:

[source,js]
--------------------------------------------------
gateway:
    recover_after_nodes: 3
    expected_nodes: 5
--------------------------------------------------

[float]
==== Dangling indices

When a node joins the cluster, any shards/indices stored in its  local `data/`
directory which do not already exist in the cluster will be imported into the
cluster by default.  This functionality has two purposes:

1. If a new master node is started which is unaware of the other indices in
   the cluster, adding the old nodes will cause the old indices to be
   imported, instead of being deleted.

2. An old index can be added to an existing cluster by copying it to the
   `data/` directory of a new node, starting the node and letting it join
   the cluster. Once the index has been replicated to other nodes in the
   cluster, the new node can be shut down and removed.

The import of dangling indices can be controlled with the
`gateway.local.auto_import_dangled` which accepts:

[horizontal]
`yes`::

    Import dangling indices into the cluster (default).

`close`::

    Import dangling indices into the cluster state, but leave them closed.

`no`::

    Delete dangling indices after `gateway.local.dangling_timeout`, which
    defaults to 2 hours.
