I was wondering if there is some way to move my site to a new server without having any or very minimal down time? Or, some way to merge databases between the old site and the new while the domain is switching?

Any ideas?

Comments

ghoti’s picture

If your database and web server are separate machines, then you should be able to run both web servers simultaneously off the same database. (If they are in geographically separate locations, this may require some magic, but still may be possible.)

Moving the database to a new server will be a little trickier. You might want to look at setting up database replication. MySQL and PostgreSQL are both capable of this, but we're about some higher-than-rudimentary DB skills to make this work. If replication isn't not possible (due to version differences, geography, learning curve, etc), your best bet is simply to dump one database, copy the dump, and import it in the new location. Your downtime will be entirely dependent on the size of your database, the speed of the copy, and of course the other issues that may get in the way, like DNS changes.

If you can have content on both the old and the new server at the same time, you can minimize the effect of domain changes by setting up a temporary virtualhost for the transition.

For instance, let's say www.example.com is your domain. On the new server, set up a ServerAlias of new.example.com, configure drupal, get ready for your database dump. Add the new server's IP at this hostname in your DNS.

On the day of your move, dump the drupal database on www and copy it to the new server. While the copy is going, make your DNS changes so that www points to the same IP as new.

When you have your database active and running on the new server, you should be able to hit your site at http://new.example.com/. Now, on your old server, set up a mod_rewrite rule that redirects all requests to new ... something like:

    RewriteEngine On
    ModRewrite ^/(.*) http://new.example.com/$1 [R]

Now, visitors whose DNS records are old will be pointed (using a 302 "temporarily moved") to the new record (which you created days ago). These redirects will gradually die off; once you see no more of them in the logs of the old server, decommission it and call it a day.

The database copy will be your biggest period of down time.

MrMattles’s picture

Database replication made easy.....
I dont usually like to post external links but hey they do use drupal themselves.....
http://www.howtoforge.com/mysql_database_replication

tonkeht33’s picture

Thank you, ghoti. That's how I mostly figured it would be moved. Yes, the servers are in totally different locations - I'm moving from shared hosting to dedicated.

I think that's the way I'm going to go, I just wanted some input on whether there was an easier way to go about this.

tonkeht33’s picture

Okay. I attempted to move my site from one server to another. I worked through lots of errors that required configuring apache2 and php.ini and whatnot, and FINALLY got the front page of the site showing up perfectly.

The problem is, when I try to go anywhere else, I get 404s. I cannot access any part of the site except for http://new.example.com/index.php?q=admin and I get an access denied, but I can't log in because it sends me to a 404.

I've searched and searched and I dunno what's going on here. Is this a problem with mod_rewrite, because it appears to be working. Any help is appreciated.

I'm running Drupal 4.6, php 5.0.3, apache2.. please help!

heine’s picture

- Can you login at http://new.example.com/?q=user
- Can you login at http://new.example.com/index.php?q=user
- What do you see when you visit http://new.example.com/

Can you post a URL?

If clean urls don't work, you should still be able to use the good old ?q= URLs

It sounds like a configuration problem, where .htaccess values are ignored. If you use .htaccess, make sure AllowOverride All is set for the drupal directory.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

tonkeht33’s picture

I lied, mod_rewrite was not enabled. ;)

It works now!

tonkeht33’s picture

I spoke too soon. Now I'm having a problem with no user passwords working. Uh oh!