Migrate your site using Drush

Ready for review -- AWAITING PEER REVIEW
In this lesson we'll learn to Migrate our sites

We have already seen how to backup and restore our sites using Drush. Now its the time we learn to migrate our sites to a different server. We would use the archive-dump command to create a backup and then transfer the files. We would then try to restore them on our new server.


1) The first step is to open the command prompt and navigate to your site's directory. Now use the archive-dump command to create the backup file.

Read more about archive-dump here.

2) Now transfer the files to the target machine using the Secure copy command or FTP.

Basic format of scp command is as follows:

scp source_file_name username@destination_host:destination_folder

With FTP, it is easy to transfer files to the host machine. Use ftp hostname to connect to the ftp server. Now enter your credentials and use the put command to send the files. You can also use a FTP client to send files in seconds.

3) Now finally let Drush perform all the remaining work on the new machine. Use the archive-restore command.

Format of the command is:
drush archive-restore [new-backup-archive] [site] --destination=./[new-folder-name] --db-url=mysql://[msql-user]:[mysql-password]@[target-server]/[db-name]

Read more about archive-dump here.

So this was how you can migrate your drupal sites easily. You database and settings.php have been set automatically. Enjoy!

Lesson tags: