For one of my sites (using PHP and MySQL) I am looking to move hosts. I am trying to do it with very little down time. Users need to be able to read/write to the database the whole time. I am wandering if my plan is feasable: - Upload the entire site to the new host well still using the old host for the live site. - Point the site on the new host to still use the MySQL database on the old host. - Change the DNS on the domain to the new host. So during propegation whether people are going to the site on the old or new host it will be updating the same database. - After 48 hours (during nonpeak hours) change it so the new host uses the new database first (so no one updates the old one well restoring). Then download from the old host and restore it on the new host. So maybe a total of 5-10 minutes of down time. Thanks in advance for any advice
Just switch to a new host and wait about 1 week to make sure things are fully switched before cancelling the old host. Maybe switch the mysql database to a different site during this time that way both are using the same database until the switch is complete. If you own another site put the database there for now. (I know very little about databases, but that is my thoughts.)
Ya, I guess a week would be a little safer. As for the database my plan was to leave it on the old host during the switch so they both use that one. Cheers
JoeO, Your plan sounds fine and one I've used many times before. Copy all of the files over to the new server and change the scripts on the new server to point to the database on the old server. Update your DNS. Wait until you are certain propagation has completed. (Refer to server logs on the old server to see when requests stop hitting the old site.) Then take down the site on the new server just long enough to copy the database over to the new site and change the scripts so they are pointing to the database on the new site. Bring the site back up and delete all of the files and database from the old server after you've made a last backup. Another trick if your DNS provider allows is to set the 'Refresh', 'Retry'. 'Expire', and 'Minimum' times to very low values. This will speed up the propagation time. Good luck, let me know if you have further questions as I do this all the time.
Joe, your plan sounds fine except for a potential problem. On most hosts, your SQL server is going to be on another machine (not on the webserver) and will not be accessable from anywhere else other than the webserver. You can check this by trying to connect to the mysql server from home or another server. If this is the case, you may be able to get your host to allow your new webserver's IP to connect.
Ya exam, I had briefly thought about that. I was just going to test it once it got to the new server. But maybe I'll try to connect to my live database from my test enviroment at home tonight.
If it is the case that you can only connect to your DBS from your webserver and your host won't change this, you could write an intermediary script (with a good password) that will execute any SQL statement and return the results (using serialize() or something). That way you could access your database from your new webserver. That would only be for a worse-case situation. (because it would be a pain)
Ya exam, thats possible, but the way my site is done that would be a huge pain. I tried yesterday and connect connect to the database from a different host. So when I'm ready I'll ask them about it, if they say no I will then try and move the database to my new host first and have both sites access it from there if possible.
Your plan sounds good, but it depends on your old host alowing remote connections to mysql. Your new host may be more helpfull in order to get your bussiness. I would 1. copy the whole thing to the new host 2. test it 3. shut down site for mantaince 3a. do fresh back-up and alter old host to use new host's db 3b. restore back-up on new host. 4. bring old site back on line. 5. do dns changes 6. wait a week or two. 7. delete old site. 8. have the new host remove remote access to db. Note: if you are using phpMyAdmin for moving your data base, you may save your data (only) with "Use ignore inserts" which will only write missing entries.
Hi JoeO, Do have a shared hosting account or reseller account. Also, where is the domain registered. If its reseller account, then its very easy, copy your entire site to new server and in old site just point the A Record to new server. Otherwise you might have to request your old host to do that, I am not sure how open they would be in doing so. If at domain registration, you have access to DNS manager, you can simply point your A record to new server. In both the cases you would be having zero downtime!
The only problem, mushroom, is what do you do with the database changes during the DNS regeneration time?
Thanks guys. I think I have all the information I need to make this go pretty smooth. I will probably be doing it in about 12 days or so. Thanks again.
Ok, sorry you're right. Although, to be pertectly honest, if the host allows access to the db server from any other IP other than the webhost, I would walk away pretty fast
Well depends on the host. I have 1 account with dreamhost that allows you to specify which ip addresses can access the db through the control panel. Not that I would host anything of much importance there though for other reasons
That would be the best solution... .. I guess I was referring to a db server that allowed connections from any IP. over & out.