小雪崩 发表于 2018-10-3 11:59:45

MySQL复制: Galera

# mysql#这里是node1  MariaDB [(none)]> CREATE DATABASE galeradb;#在node1上创建数据库
  Query OK, 1 row affected (0.00 sec)
  # mysql#这里是node1
  MariaDB [(none)]> SHOW DATABASES;#在node2上能够看到node1创建的数据库
  +--------------------+
  | Database         |
  +--------------------+
  | information_schema |
  | galeradb         |
  | mysql            |
  | performance_schema |
  | test               |
  +--------------------+
  5 rows in set (0.00 sec)
  MariaDB [(none)]> use galeradb;   #在node2上创建表
  Database changed
  MariaDB > CREATE TABLE t1 (id intauto_increment primary key, name char(4));
  Query OK, 0 rows affected (0.02 sec)
  # mysql#这里是node1
  MariaDB [(none)]> USE galeradb;
  Database changed
  MariaDB > DESC t1;#在node3能够看到node2创建的表
  +-------+---------+------+-----+---------+----------------+
  | Field | Type    | Null | Key | Default | Extra          |
  +-------+---------+------+-----+---------+----------------+

  |>  | name| char(4) | YES|   | NULL    |                |
  +-------+---------+------+-----+---------+----------------+
  2 rows in set (0.00 sec)
  MariaDB > SHOW STATUS LIKE 'wsrep%';#通过这个命令可以看到galera集群的相关信息
  +----------------------------+-------------------------------------------------+
  | Variable_name            | Value                                           |
  +----------------------------+-------------------------------------------------+
  | wsrep_local_state_uuid   | 57ba6356-0d44-11e6-8ed8-2fa7f726428a            |
  | wsrep_protocol_version   | 4                                             |
  | wsrep_last_committed       | 2                                             |
  | wsrep_replicated         | 0                                             |
  | wsrep_replicated_bytes   | 0                                             |
  | wsrep_received             | 5                                             |
  | wsrep_received_bytes       | 630                                             |
  | 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   | 1.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                                          |
  | wsrep_cert_index_size      | 3                                             |
  | wsrep_causal_reads         | 0                                             |
  | wsrep_incoming_addresses   | 172.16.1.2:3306,172.16.1.3:3306,172.16.1.4:3306 |
  | wsrep_cluster_conf_id      | 3                                             |
  | wsrep_cluster_size         | 3                                             |
  | wsrep_cluster_state_uuid   | 57ba6356-0d44-11e6-8ed8-2fa7f726428a            |
  | wsrep_cluster_status       | Primary                                       |
  | wsrep_connected            | ON                                              |
  | wsrep_local_index          | 2                                             |
  | wsrep_provider_name      | Galera                                          |
  | wsrep_provider_vendor      | Codership Oy                |
  | wsrep_provider_version   | 23.2.6(r152)                                    |
  | wsrep_ready                | ON                                              |
  +----------------------------+-------------------------------------------------+
  40 rows in set (0.00 sec)
  #完成

页: [1]
查看完整版本: MySQL复制: Galera