Database replication

How do I configure replication settings on the same mysql server, i.e. will both master and slave be on the same server?

My requirement is this: I want to replicate several tables to db2 using db1 located on the same server, but not all tables.

I looked through the whole network, here are some examples, as shown here http://www.ruturaj.net/tutorials/mysql/replication/same-server-rewrite-database but does not work for me.

And many examples explaining how to configure replication on two different servers. Can anyone redirect me to the correct link, if any?

thanks

+6
source share
1 answer

Never mind; just configure two mysql servers to two different port numbers. I used to select 3306 for master and 3307 for slave.

  • Create a new my.cnf for the sub server. (name it my_slave.cnf)
  • Modify my_slave.cnf: do this using a different port and set the slave settings to it.
  • Re-running the script: /etc/init.d/mysqld in /etc/init.d/mysqld_slave (or add new slavestart, slavestop commands in it.)

And this is my very subjective opinion: a separate replicated and non-replicable at the [database] level not at the table level. MySQL supports fine-tuning the level of replication, but it will be very difficult, while others will be confused after a few months, years later.

+1
source

Source: https://habr.com/ru/post/892989/


All Articles