In creating a cluster, you first start a single instance, which creates the cluster. The rest of the MySQL instances then connect to that cluster. For example, if you started on 10.0.0.10
by executing the command:
# service mysql start wsrep_cluster_address=gcomm://
you could then connect to that cluster on the rest of the nodes by referencing the address of that node, as in:
# service mysql start wsrep_cluster_address=gcomm://10.0.0.10
You also have the option to set the wsrep_cluster_address
in the
/etc/mysql/conf.d/wsrep.cnf
file, or within the client itself. (In
fact, for some systems, such as MariaDB or Percona, this may be your
only option.) For example, to check the status of the cluster, open
the MySQL client and check the status of the various parameters:
mysql> SET GLOBAL wsrep_cluster_address='<cluster address string>'; mysql> SHOW STATUS LIKE 'wsrep%';
You should see a status that looks something like this:
mysql> show status like 'wsrep%'; +----------------------------+--------------------------------------+ | Variable_name | Value | +----------------------------+--------------------------------------+ | wsrep_local_state_uuid | 111fc28b-1b05-11e1-0800-e00ec5a7c930 | | wsrep_protocol_version | 1 | | wsrep_last_committed | 0 | | wsrep_replicated | 0 | | wsrep_replicated_bytes | 0 | | wsrep_received | 2 | | wsrep_received_bytes | 134 | | wsrep_local_commits | 0 | | wsrep_local_cert_failures | 0 | | wsrep_local_bf_aborts | 0 | | wsrep_local_replays | 0 | | wsrep_local_send_queue | 0 | | wsrep_local_send_queue_avg | 0.000000 | | wsrep_local_recv_queue | 0 | | wsrep_local_recv_queue_avg | 0.000000 | | wsrep_flow_control_paused | 0.000000 | | wsrep_flow_control_sent | 0 | | wsrep_flow_control_recv | 0 | | wsrep_cert_deps_distance | 0.000000 | | wsrep_apply_oooe | 0.000000 | | wsrep_apply_oool | 0.000000 | | wsrep_apply_window | 0.000000 | | wsrep_commit_oooe | 0.000000 | | wsrep_commit_oool | 0.000000 | | wsrep_commit_window | 0.000000 | | wsrep_local_state | 4 | | wsrep_local_state_comment | Synced (6) | | wsrep_cert_index_size | 0 | | wsrep_cluster_conf_id | 1 | | wsrep_cluster_size | 1 | | wsrep_cluster_state_uuid | 111fc28b-1b05-11e1-0800-e00ec5a7c930 | | wsrep_cluster_status | Primary | | wsrep_connected | ON | | wsrep_local_index | 0 | | wsrep_provider_name | Galera | | wsrep_provider_vendor | Codership Oy | | wsrep_provider_version | 21.1.0(r86) | | wsrep_ready | ON | +----------------------------+--------------------------------------+ 38 rows in set (0.01 sec)