# mco_cluster_db_open

This function creates the cluster database and connects to other cluster nodes.

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

### Prototype

        MCO_RET mco_cluster_db_open(	/*IN*/ const char * dbname,
                         /*IN*/ mco_dictionary_h dict,
                         /*IN*/ mco_device_t * devs,
                         /*IN*/ mco_size_t n_devs,
                         /*IN*/ mco_db_params_t * db_params,
                         /*IN*/ mco_cluster_params_t * cl_params)

### Arguments

dbname | The name of the database to open
dict | A handle to the dictionary that was generated by schema processor `mcocomp`. Normally, this handle is passed in by passing `dbname_get_dictionary()`
devs | Memory Device parameters
n_devs | The number of Memory Devices
db_params | Database specification parameters defined in structure `mco_db_params_t`
cl_params | Network (cluster) parameters defined in structure `mco_cluster_params_t`

### Description

This function creates the cluster database `dbname` and connects to other cluster nodes specified in the `cl_params` structure. `mco_cluster_db_open()` should be called on each cluster node, once per process.

### Return Codes

MCO_S_OK | The database was created 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