开发者

Database Replication

开发者 https://www.devze.com 2023-03-20 21:25 出处:网络
How do I go about setting up replication on the same mysql server, i.e master and slave both will be the same server?

How do I go about setting up replication on the same mysql server, i.e master and slave both will be the same server?

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

I searched the whole the net there are few example like shown here http://www.ruturaj.net/tutorials/mysql/replicat开发者_运维问答ion/same-server-rewrite-database but doesn't work for me.

And many examples which explain about the replication setup on two different server Can anybody please redirect me to the right link, if any available?

Thanks


Not a big deal; just set up two mysql servers on two different port number. I've used to choose 3306 for master, and 3307 for slave.

  1. Create a new my.cnf for slave server. ( name it my_slave.cnf )
  2. Edit my_slave.cnf : make it using another port, and put slave settings in it.
  3. Duplicate startup script : /etc/init.d/mysqld to /etc/init.d/mysqld_slave ( or add new commands slavestart, slavestop in it. )

And this is my - very - subjective opinion : separate to-be-replicated and not-to-be-replicated on [database] level not on table level. MySQL supports detailed configuration for replication level, but it'll be very complicated and make others confused after months, years later.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号