title: How to move MySQL Database to another server without downtime
body: <p>We have quite big (1-4GB) MySQL Databases, which are used constantly for critical applications. We would like to move some of them to from physical server 1 (S1) to physical server 2 (S2).</p>
  
  <p>The traditional way would be to stop MySQL in S1, make SQL Dump, import it to S2 and then start using S2 as production server. This works, but it will generate significant downtime to our customers, not least because we need to transfer several gigabytes of dump data over Internet.</p>
  
  <p>Is it somehow possible to do this move with little or no downtime?</p>
  
  <p>The one strategy that I have been thinking is something like that:</p>
  
  <ol>
  <li>Start binlog in S1 for certain DB</li>
  <li>Make SQL dump while S1 is still active in production. Dump would have some sort of timestamps corresponding to the binlogs</li>
  <li>Transfer SQL dump to S2 and import it to new MySQL server</li>
  <li>Let MySQL server on S2 replicate the difference (from binlogs) between the time when the dump started and now.</li>
  <li>Set MySQL server on S2 to be slave for S1 and constantly replicate any changes on S1</li>
  <li>Make DNS change so, that any new requests to S1 would be directed to S2 instead.</li>
  </ol>
  
  <p>Would this work? And if it would, how could I do it? What should be taken into account?</p>