b.插入数据
MariaDB [(none)]> insert into wsrep_test.wsrep_test (name) values ('node1'); Query OK, 1 row affected (0.01 sec) MariaDB [(none)]> insert into wsrep_test.wsrep_test (name) values ('node1'); Query OK, 1 row affected (0.01 sec) MariaDB [(none)]> insert into wsrep_test.wsrep_test (name) values ('node1'); Query OK, 1 row affected (0.01 sec) MariaDB [(none)]> insert into wsrep_test.wsrep_test (name) values ('node1'); Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> insert into wsrep_test.wsrep_test (name) values ('node1'); Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> select * from wsrep_test.wsrep_test; +----+-------+ | id | name | +----+-------+ | 5 | node1 | | 9 | node1 | | 13 | node1 | | 17 | node1 | | 21 | node1 | | 26 | node2 | | 30 | node2 | | 34 | node2 | | 38 | node2 | | 42 | node2 | | 47 | node3 | | 51 | node3 | | 55 | node3 | | 59 | node3 | | 63 | node3 | | 68 | node4 | | 72 | node4 | | 76 | node4 | | 80 | node4 | | 84 | node4 | +----+-------+ 20 rows in set (0.00 sec)最终效果是在任何一个节点上面插入的数据,最后在每一个节点中都可以查询得到。
而且多主模型中,通过设置id自动增长的步长,避免多个节点中自动增长的id号冲突。