[摘要]+---------------------------+--------------------------------------+----------------------+--------...
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
3 rows in set (0.00 sec)
mysql>
7,验证集群复制功能
测试,在master库db1上建立测试库db1,测试表t1,录入一条数据
mysql> create database db1;
Query OK, 1 row affected (0.00 sec)
mysql> create table db1.t1(id int,cnvarchar(32));
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> insert into t1 select 1,'a';
ERROR 3098 (HY000): The table does notcomply with the requirements by an external plugin.
mysql>
mysql> insert into t1(id,cn)values(1,'a');
ERROR 3098 (HY000): The table does notcomply with the requirements by an external plugin.
mysql>
mysql>
-- # 这里原因是group_replaction环境下面,表必须有主键不然不允许往里insert值。所以修改表t1,将id字段设置程主键即可。
mysql> alter table t1 modify id intprimary key;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> insert into t1 select 1,'a';
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql>
去db2/db3上可以看到数据已经同步过去
mysql> select * from db1.t1;
+----+------+
关键词:详细介绍MySQL Group Replication[Single-Primary Mode]的搭建部署过程