I want help to replicate only couple tables between two nodes.

November 15, 2018 442 views
MySQL

I am a beginner, I did not take any steps as of now.

1 Answer

Hello,

If you would like to export only two tables and import them to your second node you could use the mysqldump command, it would look something like this:

mysqldump -u root -p your_db_name_here  table1 table2 > your_db_name_tables1_2.sql

Then you could copy the .sql file over to your seconde node and import it:

To copy the file use:

scp your_db_name_tables1_2.sql root@your.second.node.ip:/root/

To import the file to your database on your second node, first ssh to the second node and run:

mysql -u root -p your_db_name < your_db_name_tables1_2.sql

If you are actually after MySQL replication setup, you can follow the steps here on how to set that all up:

https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql

Hope that this helps!
Regards,
Bobby

by Etel Sverdlov
MySQL replication is a process that allows you to easily maintain multiple copies of a MySQL data by having them copied automatically from a master to a slave database. This can helpful for many reasons including facilating a backup for the data,a way to analyze it without using the main database, or simply as a means to scale out. This tutorial will cover a very simple example of mysql replication—one master will send information to a single slave.
Have another answer? Share your knowledge.