Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Preparations

Updated on 2024-10-21 GMT+08:00

Preparing a CSV File

Create a CSV file and write the source server information in the following format to file. Ensure that the file can be accessed.
username,ip,port,password
  • username: indicates the username for logging in to the source server. To ensure that the scripts have sufficient permissions to perform the modification, you need to run them as a user with administrator permissions, such as root.
  • ip: indicates the private IP address of the source server.
  • port: indicates the listening port of the SSH service. By default, port 22 is used on Linux. If the SSH service of the source server is running on another port, specify the port correctly.
  • password: indicates the password for logging in to the source server. The scripts use this password to automatically connect to the source server through SSH.
CAUTION:
  • The first line in the CSV file is the title line and will not be parsed by the scripts.
  • Each line in the CSV file contains the information for a single server, with each piece of information separated by a comma.
  • Ensure the format is correct and the information is accurate, avoiding any extra spaces, commas, or invalid IP addresses.
For example:
username,ip,port,password
root,192.168.1.10,xx,examplePass123
root,192.168.1.11,xx,examplePass456

Preparing the Hosts File

Create a text file that contains the content to be added to the /etc/hosts file on the source servers. Ensure that the file can be accessed. Write the API domain names mappings for the related cloud services into the file, and start with #Migration-proxy-start and end with #Migration-proxy-end. The API domain name mappings of related cloud services depend on the actual environment. Contact the environment contact person of the corresponding site to obtain the mappings.

For example:
#Migration-proxy-start
xxx.xxx.xxx.xxx  iam.xxx.com
xxx.xxx.xxx.xxx  ecs.xxx.com
xxx.xxx.xxx.xxx  evs.xxx.com
xxx.xxx.xxx.xxx  ims.xxx.com
xxx.xxx.xxx.xxx  obs.xxx.com
xxx.xxx.xxx.xxx  eps.xxx.com
xxx.xxx.xxx.xxx  vpc.xxx.com
#Migration-proxy-end

Preparing a Log Directory

  • Configure a log directory. The scripts use /var/log/update_hosts as the default log storage directory. If the directory cannot be found, the scripts automatically create it. To change the log storage directory, change the value of LOG_DIR in the script.
  • Check the permissions for the log directory. Ensure that the current user has the write permission for the log directory. If the permissions are insufficient, modify the directory permissions or use another directory.

Checking the Connectivity of the Source Servers

  • Check the network connection. Ensure that the server where the scripts are executed can access all source servers over the network.
  • Check whether the SSH port is reachable. Ensure that the SSH port (22 by default) on the source servers is reachable from the server where the scripts are executed.

Checking the SSH Configuration

  • Configure the SSH service. Ensure that the SSH service has been enabled and is running properly on all source servers. The SSH service is enabled by default on most Linux distributions.
  • Enable SSH password authentication. Ensure that the SSH service on all source servers is configured to accept password authentication so that the scripts can use the password provided in the CSV file for automatic login.

Configuring the Script Executor

Ensure that the following tools and commands are installed on the Linux server where the scripts are executed:

  • SSH: used to establish secure connections to remote source servers.
  • sed: used to edit and modify the /etc/hosts file.
  • setsid: used to avoid interaction during SSH connections, typically to prevent prompts during password input.
  • mktemp: used to create temporary files or directories.

Configuring the Execution and User Permissions

  • Configure user permissions. Ensure that the user who executes the scripts has the read and write permissions for the log directory, CSV file, and hosts file.
  • Assign execute permission to the scripts. Ensure that the update_hosts_linux.sh and rollback_hosts_linux.sh scripts are executable. Run the chmod +x update_hosts_linux.sh and chmod +x rollback_hosts_linux.sh commands to add the execute permission to the scripts.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback