I have 2 computer running on Window 7 and I wanted to try MySQL database replication.
Configuration are as followed.
2 mgt node
2 data node
2 mysqlid node
I have configure the file config.ini
[ndbd default]
noofreplicas=2
[ndbd]
hostname=192.168.0.1
NodeId=1
[ndbd]
hostname=192.168.0.2
NodeId=2
[ndb_mgmd]
hostname=192.168.0.1
NodeId=101
[ndb_mgmd]
hostname=192.168.0.2
NodeId=102
[mysqld]
NodeId=51
hostname=192.168.0.1
[mysqld]
NodeId=52
hostname=192.168.0.2
and the my.cnf(.1)
[mysqld]
ndb-nodeid=51
ndbcluster
datadir=c:\\Users\\Brian\\my_cluster\\mysqld_data
basedir=c:\\Users\\Brian\\mysqlc
port=5000
server-id=51
log-bin
and the my.cnf(.2)
[mysqld]
ndb-nodeid=52
ndbcluster
datadir=c:\\Users\\Brian\\my_cluster\\mysqld_data
basedir=c:\\Users\\Brian\\mysqlc
port=5000
server-id=52
log-bin
however, when i login to the database of the node(master) and created a new database and inserted a new table, i realised that the other node is not able to sync it.
Could someone help me address this issue?
Brian,
first of all, just to check terminology – it appears that you’re trying to use “MySQL Cluster” (where the data is held – and synchronously replicated – in the data nodes rather than in the mysqlds) rather “MySQL Replication” (which asynchronously replicates data between mysqlds).
I’ll assume that the mysqlds are the ones that came with the MySQL Cluster package (‘regular’ mysqlds will not work correctly).
In order for the tables to be stored in the data nodes (and hence be visible through all mysqlds) rather than in the local mysqld, you must specify that MySQL Cluster is the storage engine to be used: “CREATE TABLE mytab (….) ENGINE=NDBCLUSTER;”. If you don’t do that then the tables will be created with the InnoDB storage engine and will be local to each mysqld.
Note that if you want your MySQL Cluster to be completely fault tolerant then you should move the ndb_mgmds to their own host(s) rather than co-locating them with data nodes; the reason for this is explained in MySQL Cluster fault tolerance – impact of deployment decisions.
Andrew.