MySQL Cluster Only Sync Partially [closed]
-
09-10-2020 - |
Question
I am new to MySQL, but I have to solve this problem quickly.
I installed FileRun (which is a file share service) on two nodes, those two nodes have MySQL Cluster backend.
In Filerun GUI, I created a new user on the primary node, but the secondary one couldn't get the data. However, if I manually create a table and insert a data in the filerun database, the synchronise can proceed.
Here is what I did:
On both nodeA and nodeB:
mysql> use filerun;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select id,name from df_users;
+----+-----------+
| id | name |
+----+-----------+
| 1 | Superuser |
+----+-----------+
1 row in set (0.00 sec)
On nodeA, I created a new user via Filerun GUI, I query again and can see the new user has been added:
mysql> select id,name from df_users;
+----+-----------+
| id | name |
+----+-----------+
| 1 | Superuser |
| 9 | test |
+----+-----------+
2 rows in set (0.00 sec)
However, on nodeB, the table was still not updated.
mysql> select id,name from df_users;
+----+-----------+
| id | name |
+----+-----------+
| 1 | Superuser |
+----+-----------+
1 row in set (0.00 sec)
For the debug purpose, I created a new table on nodeA in the same database:
mysql> create table students (name VARCHAR(10));
Query OK, 0 rows affected (2 min 0.82 sec)
mysql> insert students set name="john";
Query OK, 1 row affected (0.08 sec)
mysql> select * from students;
+------+
| name |
+------+
| john |
+------+
1 row in set (0.01 sec)
Back to nodeB, I can see the data has been transferred:
mysql> show tables;
+-----------------------+
| Tables_in_filerun |
+-----------------------+
….omitted…..
| students |
+-----------------------+
1 row in set (0.51 sec)
mysql> select * from students;
+------+
| name |
+------+
| john |
+------+
1 row in set (0.01 sec)
At the same time on nodeB, this event was popped up by MySQL log(only shows the table replication, I don't know why):
2017-09-09T00:40:58.202248Z 1 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$filerun/students
2017-09-09T00:40:58.211230Z 1 [Note] NDB Binlog: logging ./filerun/students (UPDATED,USE_WRITE)
Again, I tried to manually insert a data into the "df_users: table on nodeA:
mysql> insert into df_users (id,name) values("2","Jack");
Query OK, 1 row affected (0.01 sec)
mysql> select id,name from df_users;
+----+-----------+
| id | name |
+----+-----------+
| 1 | Superuser |
| 2 | Jack |
| 9 | test |
+----+-----------+
3 rows in set (0.01 sec)
Unfortunately, the nodeB still receiving nothing!
mysql> select id,name from df_users;
+----+-----------+
| id | name |
+----+-----------+
| 1 | Superuser |
+----+-----------+
1 row in set (0.00 sec)
Any idea about this? How to check the transaction between two nodes?
Other information: Both two nodes has Ubuntu 14.04 installed. MySQL is installed locally,version: 5.7.18-ndb-7.6.3-log
root@ndb-mgmd:~# ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.0.20 (mysql-5.7.18 ndb-7.6.3, Nodegroup: 0, *)
id=3 @192.168.0.21 (mysql-5.7.18 ndb-7.6.3, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.30 (mysql-5.7.18 ndb-7.6.3)
[mysqld(API)] 2 node(s)
id=4 @192.168.0.20 (mysql-5.7.18 ndb-7.6.3)
id=5 @192.168.0.21 (mysql-5.7.18 ndb-7.6.3)
Solution
That is because the storage engine is not using ndbcluster. To address this, we should convert the storage engine. See my another post: Unable to Convert table Engine from MyISAM to NDBCLUSTER