Restart an instance

更新时间:
复制 MD 格式

Restart an ECS instance in the console or by calling an API to apply configuration changes, such as a new instance type or hostname, or for system maintenance. A restart interrupts services and may risk data loss.

Impacts and risks

Service interruption: Restarting an instance involves stopping and then starting it, which interrupts your services.

Data loss (force restart): A force restart discards cached data in memory that has not yet been written to a disk.

Procedure

Step 1: Preparations

  • Plan the restart time: Restart the instance during off-peak hours to minimize service disruption.

  • Stop applications: Stop application services in the operating system to ensure all in-flight requests and data writes are complete.

    To quickly restore services after the restart, check whether your critical applications are configured to start automatically on boot.
  • To prevent data loss from unexpected issues during the restart, first create a snapshot before restarting the instance.

    Snapshots are a paid feature. For more information about billing, see Snapshot billing.

Step 2: Restart the instance

Console

  1. Log on to the ECS console - Instances page. In the top-left corner, select the resource group and region where the target instance is located.

  2. Click the instance ID to open its details page, and then click Restart in the upper-right corner.

  3. In the dialog box that appears, select a restart mode.

    • Normal restart (default): Do not select Force Restart. The operating system attempts to gracefully shut down all processes before restarting the instance.

    • Select Force Restart: This action is equivalent to a power cycle and risks data loss and file system corruption. Use this option only if the instance is unresponsive to a normal restart.

  4. Choose a restart method:

    • Restart Now: Click OK.

    • Scheduled Restart: Select this option to restart the instance at a specific time. Configure the time, select a role, and then click OK to create the scheduled restart task. After the task is created, you can go to the CloudOps Orchestration Service (OOS) console - Scheduled O&M page to modify the task configuration.

Restarting an instance can take 3 to 5 minutes, and up to 20 minutes in some cases. During this time, the operating system and the virtualization layer release resources such as processes, CPU, and memory. Please wait for the process to complete.

API

Call the following API operations to restart one or more ECS instances.

To schedule an instance restart, use the OOS Scheduled Restart Task template.

FAQ

Why doesn't the reboot command apply changes?

We recommend that you restart your ECS instance in the console or by calling an API. This method loads the full instance configuration and applies underlying changes that the operating system cannot detect. Therefore, when you change the instance type, modify the hostname, perform an offline disk expansion, or need to restart the instance for a system maintenance event, you must use the console or an API to apply these changes. The reboot command within the operating system is ineffective for these scenarios.

Instance stuck in Stopping or Starting state

To troubleshoot this issue, see FAQ about instance startup and shutdown exceptions.

RAM user permissions for instance restart

A RAM user must have the ecs:DescribeInstances and ecs:RebootInstance permissions.

Find and modify a scheduled restart task

Scheduled restart tasks created in the ECS console are executed by Cloud Assistant. To find and modify an existing scheduled restart task, go to O&M and Monitoring > Send Command/File (Cloud Assistant) in the left navigation bar of the ECS console and click the Tasks tab. In the task list, find the corresponding scheduled restart task and click Modify in the Actions column to edit configurations such as the execution schedule and command content. For more information, see Modify task execution information.

Related topics