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 OnlineThe same information can also be displayed using the function
mco_cluster_info()
with an SQLselect
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 OnlineDetach
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 detachedThe database can also be detached using the function
mco_cluster_detach()
with an SQLselect
statement:XSQL>select mco_cluster_detach(); Successfully detachedAttach
The
attach
command reconnects a database to the cluster after a previousdetach
. The database then becomes available for both reading and writing. For example:XSQL>cluster attach Successfully attachedThe database can also be attached using the function
mco_cluster_attach()
with an SQLselect
statement:XSQL>select mco_cluster_attach(); Successfully attached