# mco_cluster_attach

This function re-connects to the cluster after a previous `cluster_stop()` or `cluster_detach()`.

### For an overview see page Cluster Applications in C

### Prototype

        MCO_RET	mco_cluster_attach(	/*IN*/ mco_db_h db,
                        /*IN*/ mco_cluster_params_t * cl_params)

### Arguments

db | The database handle. The database must be previously opened using `mco_cluster_db_open()`.
cl_params | Network (cluster) parameters. Note that the buffer sizes (`cl_sndbuf` and `cl_rcvbuf`) must be the same values as in the `mco_cluster_db_open()` call

### Description

This function re-attaches this node to the cluster after a call to `mco_cluster_stop()` or `mco_cluster_detach()`. Note that all local changes made after `mco_cluster_detach()` will be discarded.

### Return Codes

MCO_S_OK | The database was attached successfully, and connections to other nodes were established
MCO_E_CLUSTER_NOQUORUM | The database was created, but the cluster environment was not able to connect to a sufficient number of other nodes to achieve a quorum
MCO_E_CLUSTER_INVALID_PARAMETER | Wrong cluster parameters (e.g. `node_id` >= `n_nodes`)
MCO_E_CLUSTER_PROTOCOLERR | Protocol error during initialization of the database
MCO_E_CLUSTER_INCOMPATIBLE_MODE | Incompatible modes or dictionaries on different nodes
MCO_E_CLUSTER_SYNC | Error during database initial synchronization.
MCO_E_NW_* | Error initializing the network layer.
Other | Refer to `mco_db_open_dev()`

### Files

Header file:
mcocluster.h
Source file:
mcocluster.c
Library:
libmcocluster.a