Overview
This article provides a step-by-step guide on how to move data between data centers using network volumes, SSH, and the `rsync` command. The process involves creating network volumes, deploying pods, setting up SSH keys, and using `rsync` to transfer data securely.
Prerequisites
- Access to the source and target data centers.
- Permissions to create network volumes and deploy pods.
- Basic knowledge of SSH and terminal commands.
Steps to Move Data Between Data Centers
1. Create a New Network Volume in the Target Data Center
- Log in to the target data center's management interface.
- Create a new network volume where the data will be stored.
2. Deploy Pods in Both Data Centers
- Deploy two pods using the default RunPod PyTorch template.
- Source Pod: Mount the source network volume.
- Target Pod: Mount the target network volume.
3. Start the Web Terminal in Both Pods
- Access the web terminal for both the source and target pods.
- Ensure both terminals are ready for command execution.
4. Install Required Packages
- On both the source and destination servers, update the package list and install necessary packages:
apt update && apt install -y vim && apt install -y rsync
5. Generate SSH Key on the Source Machine
- On the source machine, generate an SSH key pair:
ssh-keygen -t rsa -b 4096 -C "my-email@company.com"
- Display the public key and copy it:
cat ~/.ssh/id_rsa.pub
6. Add the Public Key to the Destination Machine
- On the destination machine, open the `authorized_keys` file:
vi ~/.ssh/authorized_keys
- Insert the copied public key into the file and save it.
7. Transfer Data Using `rsync`
- Obtain the destination pod's IP address and port number from the connection options.
- On the source machine, run the `rsync` command to transfer data:
rsync -avz -e "ssh -p destination_port_number" /workspace/ root@destination_ip:/workspace
Example:
rsync -avz -e "ssh -p 34592" /workspace/ root@66.114.112.70:/workspace
Additional Notes
- Ensure that the SSH service is running on the destination pod.
- Verify that the network volumes are correctly mounted in both pods before starting the data transfer.
- Monitor the data transfer process to ensure it completes successfully.
Troubleshooting
- SSH Connection Issues: Ensure that the SSH key is correctly added to the `authorized_keys` file and that the destination pod's firewall allows SSH connections.
- `rsync` Errors: Check that the source and destination directories exist and that you have the necessary permissions to read/write data.
Conclusion
By following these steps, you can efficiently move data between data centers using network volumes, SSH, and `rsync`. This method ensures a secure and reliable data transfer process.
Comments
0 comments
Please sign in to leave a comment.