We have a common database in MySQL 5.6 and many services are using that. one of the services want to migrate some tables from common database to new MySQL server 5.7.
The old MySQL server continuously using by another service. The total data size is around 400GB.
Is there any recommended procedure?
Two Approaches
Approach: 1
create a slave with mysql version 5.7 and replicate only the common database with the below option replicate-db
At the point of no feeds happening on master, and no lag in slave. Use this as a new server, by stopping the slave and disconnect the master from slave.
On slave:
STOP SLAVE
To use RESET SLAVE, the slave replication threads must be stopped
$> RESET SLAVE
On Master:
Remove the replication user
FLUSH LOGS
Approach:2
Try the backup method
Since the db size is 400 GB, the mysqldump won't be sufficient.
Try partial backup method using xtrabackup:
xtrabackup --backup --tables-file=/tmp/tables.txt
Once the Backup has been completed, verify and restore it into the new server version 5.7.
Reference:
https://www.percona.com/doc/percona-xtrabackup/2.4/xtrabackup_bin/xbk_option_reference.html#cmdoption-xtrabackup-tables-file
np: On both approaches, make sure to check the table/mysql version compatibility [5.6 vs 5.7]
Related
I am trying to configure MySQL databases using the Master-Slave replication. Before I realized that I had to set up my environment using this replication, I already have 2 separate servers running their own MySQL DB. Each of these servers are configured the exact same. The MySQL DB are configured with hundreds of tables.
Is there a way that i can set up (Master-Slave) Replication using the configured DB's? Or will i have to start from scratch and configure the replication first and then load in all the DB tables?
You can delete all data from one of the servers. Remaining one with the data will be your Master. Then use mysqldump to backup all the data and insert it to the slave.
Take a look for the detailed instructions on the page below:
https://livecaller.io/blog/how-to-set-up-mysql-master-slave-replication/
If the data is exactly same in both the MySQL database then you can start master slave replication, but you need to be sure that the data is same. MySQL will not check that, and if there is some discrepancy in the primary key then it will throw error immediately after next DML statement.
To be on a safer side, drop the database from one server, and restore it using the MySQL dump of another server. This will give the surety that database is same on both the server.
Take the reference from the below link to establish replication between two MySQL servers.
https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql
I have a MySQL Replication setup up and running:
Database A (Server 1 as master) --> Database A (Server Z, acting as the slave)
I now want to use the same Slave Server (Z) to be a slave of two other databases; totally different databases (e.g. B and C), not other copies if Database A.
I've followed this simple guide:
https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql
But when it comes to adding the second database to the slave server in /etc/my.cnf, I don't see how it's possible to have more than one profile.
Basically I am thinking I need both of these blocks in my.cnf on the slave server but it won't be that simple, right?
log_error="/var/log/mysql/error.log"
server-id=2
log_bin="/var/log/mysql/mysql-bin.log"
binlog_do_db=database_a
log_error="/var/log/mysql/error.log"
server-id=3
log_bin="/var/log/mysql/mysql-bin.log"
binlog_do_db=database_b
Is it possible, or do I literally need a new slave server for each unique database I want to replicate?
Is it possible to, on the slave server, have specific conf files for each database, e.g. /etc/databasea.cnf and /etc/databaseb.cnf so I can specify different settings for each database?
Thanks in advance
Multi-source replication is only available in MySQL starting with 5.7.6 or MariaDB starting with 10.0.1.
Multi-Source Replication enables a replication slave to receive transactions from multiple sources simultaneously. Multi-source replication can be used to back up multiple servers to a single server, to merge table shards, and consolidate data from multiple servers to a single server. Multi-source replication does not implement any conflict detection or resolution when applying the transactions, and those tasks are left to the application if required. In a multi-source replication topology, a slave creates a replication channel for each master that it should receive transactions from.
Source:
MySQL : http://dev.mysql.com/doc/refman/5.7/en/replication-multi-source.html
MariaDB: https://mariadb.com/kb/en/mariadb/multi-source-replication/
I couldn't find an answer to my question.
I have 2 mysql servers.
1) Master server
2) Slave server
Now i configure them for replication. After configuration the records which i add in master server are successfully replicated on slave server. But i also need those records which are already in master server (before replication setup) to be replicate in slave server (after replication setup). Now how can i replicate those past records from master server to slave server?
Replication doesn't support this.
Standard procedure is to start replication on the master, note the replication position somewhere, take a db dump, import it into the slave, and enable replication from the previously noted position.
mysqldump has a flag to automatically configure the slave's replication position in the dump file.
I want to create Database replication i try but some problem is there so give me full steps of How To Set Up Database Replication In MySQL
Never done it personally at work but we do use it.
Seems that you want to setup a master/slave setup, the slave beeing the replicated server.
http://dev.mysql.com/doc/refman/5.0/en/replication-howto.html (check the documentation is up to date with your mysql version.)
Here is a step by step instruction how to get MySQL master-slave replication automatically installed and later scaled http://blog.jelastic.com/2017/03/14/scalable-mysql-master-slave-replication/ (if you are ready to run this cluster in the specific cloud)
I have an existing mysql replication set up (Windows 2008 to Ubuntu 9.04) and created several new tables in the master database. These are not showing up in the slave database.
Do new tables automatically get copied to the slave DB, or do I need to set up replication again?
Thanks!
I'm going to assume that other data is successfully replicating.
Replication in mysql is per-server, so the most likely problems are that either you aren't binloging the events, or that the slave is ignoring them.
For binglogs, verify you aren't turning sql_log_bin off for the connection (which would require SUPER) and that the various options binary-log options are set correctly. You can verify this by running mysqlbinlog on the server's binlogs.
On the slave side, check the replication options.