# xSQL Cluster Control

> The following sections demonstrate a set of cluster control commands are provided by xSQL to get information from, detach and attach cluster nodes.

> ### For an overview see page xSQL Commands

> ## Cluster info

> The `cluster info` command shows a list of the current cluster nodes and their states. For example:

>         XSQL>cluster info
>         NodeId           Address                          QRank     State
>         *    0        127.0.0.1:15000                       100     Online
>          1        127.0.0.1:5001                          1     Offline
>          2        127.0.0.1:15001                         1     Offline
>          6        127.0.0.1:15005                         1     Online

> The same information can also be displayed using the function `mco_cluster_info()` with an SQL `select` statement:

>         XSQL>select mco_cluster_info();
>         NodeId           Address                          QRank     State
>         *    0        127.0.0.1:15000                       100     Online
>          1        127.0.0.1:5001                          1     Offline
>          2        127.0.0.1:15001                         1     Offline
>          6        127.0.0.1:15005                         1     Online

> ## Detach

> The `detach` command disconnects a database from the cluster. The database then becomes unavailable for both reading and writing. For example:

>         XSQL>cluster detach
>         Successfully detached

> The database can also be detached using the function `mco_cluster_detach()` with an SQL `select` statement:

>         XSQL>select mco_cluster_detach();
>         Successfully detached

> ## Attach

> The `attach` command reconnects a database to the cluster after a previous `detach`. The database then becomes available for both reading and writing. For example:

>         XSQL>cluster attach
>         Successfully attached

> The database can also be attached using the function `mco_cluster_attach()` with an SQL `select` statement:

>         XSQL>select mco_cluster_attach();
>         Successfully attached