Database Replication
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.
- Create a new my.cnf for slave server. ( name it my_slave.cnf )
- Edit my_slave.cnf : make it using another port, and put slave settings in it.
- 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.
精彩评论