mysql replication on master in node1 _on rack1 and slave on node2_on rack2 to prevent failover
great tutorial. I am new to mysql . In the tutorial you wrote below
In this tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql
1) In your tutorial you did execute below command on master
GRANT REPLICATION SLAVE ON . TO 'slave_user'@'%' IDENTIFIED BY 'password';
so if i understand above statement right your are giving replication privileges to user slaveuser bearing "password" on current database using " . " .
The slave is not set yet but your are saying if any exist, this user "slaveuser" can do it
question :@'%' will do this mean?
2) (Talking in my case master mysql on node1 with usernames devsql1, devsql2 and so on) .
in my case if want to allow only certain user on only particular host is this the solution:
GRANT REPLICATION SLAVE ON . TO 'devsq1'@'node1' IDENTIFIED BY 'password'
bashshell>mysqldump -u root -p --opt newdatabase > /home/dev01/metstorebkp/newdatabase.sql ( will dump the current database script after locking)
3)in your tutorial
188.8.131.526- Slave Database
where are you binding this on slave of node2 on _rack2?Do we need to bind this or not in my.cnf on slave installation of mysql on node ?
-----> bashshellonnode2> mysql -u root -p newdatabase < /path/to/newdatabase.sql
( This is one time script to run on node2 _on rack2 right?)
( My question is because this is cluster setup in "n" no of nodes in a racks and connecting to different racks needs SCP to copy from one node1 to node2 . So if copying newdatabase.sql script once from node1 to node2 using SCP is good enough right?
-----> mysqlshell>CHANGE MASTER TO MASTERHOST='184.108.40.2069',MASTERUSER='slaveuser', MASTERPASSWORD='password', MASTERLOGFILE='mysql-bin.000001', MASTERLOGPOS= 107;
Are u executing this statement on slave ? And in my scenario do i have to execute this node2 on rack2?
In the above statement you don't need to give full path to MASTERLOGFILE in node1?
In my scenario If above statement executed on node2 means it's providing to mysql installation on node2 that MASTERHOST is as provided with IP address?
Does this statement if executed on node 2 _ rack 2 mysqlshell> start slave (does this mean you are defining this as slave)
What other steps are necessary and important please let me know?