Elastic Cloud Server

Cloud Migration of a Single-Server Website to a Distributed Cloud Architecture

2025-11-25 08:31:35

Scenario Description

Many customers start out using the cloud as a simple physical server, where they store applications, databases, and files on the same cloud server. The cloud provides customers with not only servers, but also many other cloud products, so that customers can implement cloud-enabled architecture and ultimately bring advantages such as high availability and scalability.

Scenario Architecture

Use with other products

The test scenario is also used in conjunction with other component products, and the product list is as follows.

· Cloud Server ECS

· Cloud Database RDS (a stable, reliable, and scalable online database service)

· Load Balancing SLB

· Object-oriented Storage OSS (cloud storage service)

Test Scenario 1: Separation of service and data

Deploy changes: Login to the ECS server via SSH, change the parameters of the service access database to the RDS address and account (formerly access the MySQL database via WordPress).

Test Steps:

1. Build your own MySQL data in the ECS server.

2. Build your own WordPress service in the ECS server.

3. Access the MySQL database via WordPress.

Reference Commands:

###########Configure wordpress to access MYSQL

cd /var/www/html/

cp wp-config-sample.php wp-config.php

vim wp-config.php

###########

// ** MySQL settings - Specific information comes from the host you are using ** //

/** WordPress name */

define('DB_NAME', 'db_wordpress');

/** MySQL database username */

define('DB_USER', 'user_wordpress');

/** MySQL database password */

define('DB_PASSWORD', 'pwd_wordpress');

/** MySQL server */

define('DB_HOST', 'localhost');

/** Default text encoding when creating a data table */

define('DB_CHARSET', 'utf8');

/** Database collation type. Do not change if you are not sure */

define('DB_COLLATE', '');

1. Access the MySQL database via WordPress.

Visit http://IP and jump to the WordPress installation page;

Set up site and user information;

Log in to WordPress, and then you can use it normally.

1. Check RDS, create the database db_wordpress, and grant the account user_wordpress read and write permissions to the database.

2. Deploy changes.

Log in to the ECS server via SSH the parameters of the service access database to the RDS address and account.

Reference Commands:

###########Configure wordpress to access RDS

cd /var/www/html/

vim wp-config.php

###########

// ** MySQL settings - Specific information comes from the host you are using ** //

/** WordPress name */

define('DB_NAME', 'db_wordpress');

/** MySQL database username */

define('DB_USER', 'user_wordpress');

/** MySQL database password */

define('DB_PASSWORD', 'Hello1234');

/** MySQL server */

define('DB_HOST', '');

/** Default text encoding when creating a data table */

define('DB_CHARSET', 'utf8');

/** Database collation type. Do not change if you are not sure */

define('DB_COLLATE', '');

1. Verify change results.

Visit http://IP to jump to the WordPress page.

If you have done the database migration, you can directly access the WordPress homepage; If you don't migrate the database, you'll be prompted to reinstall the site because the link is to the new RDS database. Both cases are correct, the following screenshot shows an example without database migration:

Test Scenario 2: Service high availability and ECS expansion

Create an expanded ECS (which can be achieved by creating snapshots and images), unbind EIP and ECS, and then bind them to SLB, both of which can access the external network.

Test Steps:

1. Create an SLB instance and bind EIP and ECS1.

2. Create a cloud server snapshot through this ECS1, and create a image to generate a cloud server ECS2.

3. Deploy changes: Unbind the EIP from ECS1 and bind the EIP to the SLB.

4. Bind SLB and ECS1/ECS2.

5. Verify change results: If you visit the EIP address, you can open the WordPress page, then it is normal.


gD0yt6BfHolG