Change Chaindata
CN Node Migration STEP
Create new disk
- Preparing new disk (3,500GB disk) or creating new path on the current disk (It must have 3,500GB available.)
Option 1 - New disk (more than 2500GB)
- Attach the disk to EC2 and run the command below
$ lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTnvme2n1 259:0 0 3500G 0 disk **# New Disk**nvme1n1 259:0 0 4000G 0 disk /var/kcndnvme0n1 259:2 0 8G 0 disk├─nvme0n1p1 259:3 0 8G 0 part /└─nvme0n1p128 259:4 0 1M 0 part
- Mount it following the process below
$ sudo e2fsck -f /dev/nvme2n1$ sudo mkfs -t ext4 /dev/nvme2n1$ sudo mkdir /var/kcnd2$ sudo mount /dev/nvme2n1 /var/kcnd2$ sudo mkdir /var/kcnd2/data$ sudo mkdir /var/kcnd2/log
Option 2 - Current Disk (not recommended)
- Create New Folder
$ sudo mkdir /var/kcnd2/data$ sudo mkdir /var/kcnd2/log
Download the latest chaindata
Download Chain Data to the data of the new Klaytn Data DIR. (You can check the details on Chain Data in https://packages.klaytn.net/cypress/chaindata/)
- Download with the following command
# (Option 1: recommended) curl $ curl -o klaytn-cypress-chaindata-2021???????????.tar.gz "https://s3.ap-northeast-2.amazonaws.com/klaytn-chaindata/cypress/klaytn-cypress-chaindata-2021???????????.tar.gz"# (Option 2) aws s3 command$ aws s3 cp s3://klaytn-chaindata/cypress/klaytn-cypress-chaindata-2021???????????.tar.gz klaytn-cypress-chaindata-20211113011111.tar.gz # (Option 3) axel (need to install axel)sudo amazon-linux-extras install epel -ysudo yum install axel pigz$ axel -n8 https://s3.ap-northeast-2.amazonaws.com/klaytn-chaindata/cypress/klaytn-cypress-chaindata-2021???????????.tar.gz
- Decompress
# (Option 1: recommended) tar$ tar -xvf klaytn-cypress-chaindata-2021???????????.tar.gz# (Option 2) pigz (need to isntall pigz)$ tar -I pigz -xvf klaytn-cypress-chaindata-2021???????????.tar.gz
Configure DATA_DIR & LOG_DIR
Option 1 - Swap the old & new path
-
Stop klaytn daemon process before swap
- IMPORTANT Remove CN node in Klaytn council if the node type is CN
💡 You can get packages for EN in the Startup the CN.
-
Swap the old and new path
-
New Disk
umount /var/kcnd # old pathumount /var/kcnd2 # new pathmount /dev/nvme2n1 /var/kcnd
💡 These commands should be executed with the appropriate privileges.
-
Current Disk
sudo mv /var/kcnd /var/kcnd_old # old_pathsudo mv /var/kcnd2 /var/kcnd # new path
-
-
(Optional) Delete the old path if it is not required anymore
Option 2 - Update DATA_DIR & LOG_DIR in klaytn config file
- Klaytn DIR Path Change
- Option 1 - New disk
- Change
fstab
value from old disk to new disk
- Change
- Option 2 - Current disk
- change the DIR Path from
kcnd.conf
- change the DIR Path from
- Option 1 - New disk
Restart Process(or Reboot Instance)
- IMPORTANT Remove CN node in Klaytn council if the node type is CN
- Restart process or reboot instance