5

I have country-wise MySQL servers and one master server.

The master server has all country data.

In that I want to copy data of a particular country from the master MySQL server.

Example: if any data inserted on the master MySQL server is related to India, it will also be inserted into the Mysql server in India.

How can this be achieved?

Table structures in both a country-level server and the master server are the same:

--
-- Table structure for table `vxp_service_types`
--
CREATE TABLE IF NOT EXISTS `vxp_service_types` (
  `st_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `st_name` varchar(25) NOT NULL,
  PRIMARY KEY (`st_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ;
  • you may introduce a trigger on main table to insert required data to another table and then replicate/copy that copied table wherever needed...hope it – Nawaz Sohail Jun 16 '15 at 13:15
  • Please show the table structure of the table that has all data (including India) – RolandoMySQLDBA Jun 17 '15 at 3:12
  • Are you asking how to initially copy a table from one machine to another? Or are you asking how to continually replicate a table that is already populated in both a Master and a Slave? – Rick James Jun 17 '15 at 4:10
  • @RickJames : I am asking about how to continually replicate a table that is already populated in both a Master and a Slave. – Bhavin Solanki Jun 17 '15 at 4:53
  • @RolandoMySQLDBA : i just update question . please find sample table structure in question. – Bhavin Solanki Jun 17 '15 at 5:00
1

You could restrict on table level. This can be done by ignoring some tables, or by only specifying the databases/tables that you want.

http://dev.mysql.com/doc/refman/5.0/en/replication-options-slave.html#option_mysqld_replicate-do-table

Example: --replicate-wild-do-table=foo%.bar% replicates only updates that use a table where the database name starts with foo and the table name starts with bar.

Example: --replicate-wild-ignore-table=foo%.bar% does not replicate updates that use a table where the database name starts with foo and the table name starts with bar.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.