Re: Database restore
Gordan Bobic <[email protected]>
| Newsgroups | gmane.mail.imap.dbmail |
|---|---|
| Message-ID | <[email protected]> |
On 2015-02-05 14:36, Casper Langemeijer wrote: > On 05-02-15 15:11, Reindl Harald wrote: >> >> Am 05.02.2015 um 15:00 schrieb Curtis Maurand: >>> Thanks, I'll give that a shot while i look at replicatuon which I've >>> never been able to make work >> >> there is nothing difficult and is configured within 5 minutes > I disagree, the learning curve is not 5 minutes long (but well worth > your time) Depends on how familiar you are with mysql already. It fundamentally boils down to: 1) Set these in master's my.cnf: server-id=<some number> log-bin and restarting the master 2) Dump the data from the master (e.g. using mysqldump --single-transaction --master-data=2 > mymysqldump.sql) 3) Prepare the slave and import the data: mymysqldump.sql | mysql -uroot -p<rootpasswprd> 4) grep 'CHANGE MASTER' mymysqldump.sql and use that fragment in your CHANGE MASTER TO statement to set the master hostname, port, binlog file name, and binlog file position (above grep will return the master file and position) 5) On the slave execute START SLAVE; It is fairly trivial, and massively simpler than on just about any other database. >> just enable binlog on the current server, rsync the datadir to the new >> slave and start replication there > > Instead of using rsync, consider xtrabackup. When all your tables are > innodb (no myisam), it allows you to create a backup without stopping > the server (except for configuration changes, binlog needs to be > enabled before making the backup) > > http://www.percona.com/doc/percona-xtrabackup/2.2/ > > I've written a blog post about it a few years back: > http://techblog.procurios.nl/k/n618/news/view/56429/14863/how-to-migrate-mysql-databases-without-downtime.html > > But seriously: master-master mysql replication (or the galera > solution) should be a bare minimum on ALL database servers you deploy > from now on. > _______________________________________________ > DBmail mailing list > [email protected] > http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail