How To Downgrade DigitalOcean Droplets




디지털 오션 사용중 droplet(DO의 가상서버 명칭)의 사양을 낮춰야 하는 일이 생김

AWS만 사용하다보니… 디지털 오션의 관리콘솔 사용 및 특징에 대한 인지를 제대로 못하고 있었는데..
오늘 들어가 봤다.. ㅋ

결론은 디지털오션의 관리콘솔에서 기본 제공 하는 기능이 아님
– 업그레이드는 가능 하지만
– 다운그레이드는 지원 하지 않음

스냅샷을 뜬 후에, 해당 스냅샷으로 다시 droplet을 생성하려 해도…
스냅샷 원본 서버의 사양과 동일하거나 그 이상의 사양으로만 생성이 가능

한마디로 편한 방법은 없지만

리눅스 서버의 경우 튜토리얼을 통해 소개를 하고 있다.
물론 약간의 지식이 있어야 하지만

rsync로 옮기라고… ㅋ

URL : https://www.digitalocean.com/community/tutorials/how-to-downgrade-digitalocean-droplets


Introduction

To downsize a Droplet’s CPU, RAM, disk, or overall plan, follow the steps below.

As you create and use your Droplets, you may find that the plan you’ve chosen for any given Droplet is above your needs at this time, and downsizing is appropriate. This guide will help you accomplish this quickly and with your data intact. We do not provide this feature through our interface, as data integrity, sizing, and authentication between Droplets can be complex.

Warning

We strongly recommend backing up your Droplet before following this tutorial. Without a backup, you risk data loss if anything goes wrong during the downsizing process.

Prerequisites

One source Droplet that you wish to downsize (noted here as 111.111.111.111)

Step One – Creating a New Small Droplet

Log in to your DigitalOcean control panel and create a destination Droplet with your desired smaller size and region that you can transfer data to from your larger source Droplet. You should ensure that your OS remains the same as the locations of key files, applications, and resources must be consistent for data to move between the source Droplet and the destination Droplet correctly. If your previous droplet used one of our one-click applications, choose that application as well. Also, remember to select an SSH key or provide an updated root password.

We will refer to this Droplet with the IP address 222.222.222.222 for the rest of this guide.

Step Two – Authorizing Your Droplet

In this step, we’ll add the SSH key generated on 222.222.222.222 to the 111.111.111.111’s authorized keys for root, or a sudo user.

Log into your destination Droplet at 222.222.222.222 and run the following command, which generates a new SSH key. You can then install it on your source Droplet at 111.111.111.111 to prepare for your data transfer.

  • ssh-keygen -t rsa

You will be asked a series of questions, during which time you can modify the folder in which SSH keys are saved, or provide a password to secure your SSH keys. Press Enter at each question to proceed without a password, and accept the default location of the SSH key files.

You may want to password protect your keys to add another layer of authentication and security as this will prevent anyone who has your SSH key file from being able to use them without your password. However, it may be cumbersome to need to authenticate in order to use your SSH key each time:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/demo/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/demo/.ssh/id_rsa.
Your public key has been saved in /home/demo/.ssh/id_rsa.pub.

Once this is complete, you can copy the public SSH key to your 111.111.111.111’s authorized_keys file:

  • ssh-copy-id sammy@111.111.111.111

You should see the following output once this command runs:

The authenticity of host '111.111.111.111 (123.45.57.89)' can't be established.
RSA key fingerprint is b1:2d:33:67:ce:35:4d:5f:f3:a8:cd:c0:c4:48:86:12.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '111.111.111.111' (RSA) to the list of known hosts.
user@111.111.111.111's password:
Now try logging into the machine, with "ssh 'user@111.111.111.111'", and check in:

  ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Try logging into your larger source Droplet once from your smaller destination Droplet using SSH to confirm this works without requesting a password.

Step Three – Using rsync to Copy Files

rsync is a tool that can be used to copy files between two servers. In this case, you can use it to move your files from 111.111.111.111 to 222.222.222.222.

Run this command from 222.222.222.222 by first connecting to your Droplet with ssh:

  • ssh sammy@222.222.222.222

Then proceed to the next command.

This is a long command, so make sure you have scrolled all the way to the right and copied the whole thing! This command uses the parameters for archive and verbose modes, which preserves symbolic links, devices, permissions and ownerships, modification times, access control lists, and extended attributes. You will also see a detailed list of transferred files, which are inclusive of folder like /var, /etc, and your home folder. The content that is excluded by this command is temporary or Droplet-specific information that your destination Droplet will already contain.

  • sudo rsync -aAXvP –exclude={/boot/,/dev/,/etc/fstab,/etc/modprobe*,/etc/modules/,/lost+found/,/etc/mtab,/etc/network*,/etc/sysconfig/ip*,/etc/sysconfig/kernel,/etc/sysconfig/network*,/lib/modules/,/media/,/mnt/,/proc/,/run/,/sys/,/tmp/,/var/lib/lxcfs/,/var/lock/} root@111.111.111.111:/ /

Once you’ve run this rsync command, your large source Droplet information should now be migrated to your small destination Droplet. You may want to browse through your destination Droplet to ensure that the content you expect is in place and confirm that any apps or sites are able to run correctly.

(Optional) Step Four – Changing the A Record

If you currently use the DigitalOcean control panel to set an A record for your Droplet, this step will guide you through changing that record to appropriately reflect your new Droplet’s 222.222.222.222 IP address.

Now we need to move into the DigitalOcean control panel.
Select DNS from the left navigation menu then click inside the IP section of the A record previously configured for your large Droplet, and replace it with the IP address of your new small Droplet. Click *save, and your Droplet will now be connected to your domain name. This may take a short time to propagate, during which time you will want to leave your large Droplet running.

Create Droplet Menu

Once you have confirmed that your domain is resolving to the IP of your new 222.222.222.222 Droplet, and your app, db, or service is running correctly, you can destroy your source 111.111.111.111 Droplet.

DigitalOcean does not reserve IP addresses, so you will need to update any references to the IP address used for your larger Droplet to the one used by your smaller Droplet in your DNS records, links, or app.

Conclusion

By following this tutorial, you have successfully downsized your Droplet to an appropriate size, moved your data to the new Droplet, and connect your DNS A record to your new IP.

Thanks to Reid from the Digital Ocean user community for the previous version of this guide.


 

 




About KENNETH 9051 Articles
지락문화예술공작단

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.