Question

What steps do I take to have my two droplets share a single droplet?

Posted November 21, 2020 90 views
ApacheWordPressDigitalOcean 1-Click Apps MarketplaceDigitalOcean Droplets

I want to host two websites in a single droplet. I currently have two droplets through the wordpress installation by digitalocean set up already. I now want shut one droplet down, but move the contents of that droplet, so that it’s sharing a single droplet with the other.

I have read on how to set up new virtual hosts using Apache here: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-18-04

However, I have been unable to find resources that are about my case of moving the contents within an already setup droplet into another droplet. How do I move the files around?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there @theindiman,

There are two ways of migrating your website:

Manual migration

What you could do in this case is to use rsync to copy the files from the Droplet that you will be shutting down to the one that you would want to keep.

To get started, you have to set up SSH keys between the original and new Droplets. You can also follow a more comprehensive migration process:

https://www.digitalocean.com/docs/droplets/resources/downsize/

Here is a summary of what needs to happen:

  • SSH to your new Droplet

  • Use rsync to transfer the files from the old Droplet to the new one, the command will look like this:

  • rsync -avz --progress 111.222.333.444:/var/www/site1 /var/www/
  • After that backup your WordPress Database from the old Droplet, you can use the mysqldump command to do so:
mysqldump -u database_user -p database_name > database_name.sql

And then again using the rsync command copy only the .sql file to your new Droplet.

  • Once you have your .sql dump file on the new server, create a new MySQL database and username, and import the .sql file:
  • mysql -u database_user -p database_name < database_name.sql

Migration with a plugin

As another option you could use a plugin like the Duplicator – WordPress Migration Plugin, this will allow you to generate a full backup of your website files and database. Then you will need to install a fresh new WordPress copy on the new Droplet and run the import script.

Hope that this helps!
Regards,
Bobby

Submit an Answer