O035、Nova Suspend / Rescue 操作详解

 
Suspend / Resume
 
有时候需要长时间暂停 instance , 可以通过 Suspend 操作将instance 的状态保存到宿主机的磁盘上。需要恢复的时候,执行 Resume操作从磁盘读回 instance 的状态,然后继续运行。
 
这里对 Suspend 和 Pause 做个对比:
 
相同点:都是暂停 instance 的运行,保存状态,需要恢复的时候执行 resume 恢复之前状态。
 
不同点:
 
    1、Suspend 将 instance 状态保存在磁盘上;Pause 是保存在内存中,所以 Pause 恢复的要快
    2、instance 被 Suspend 后,状态为 shutdown ,而 Pause 的 instance 状态是 Paused
    3、虽然都是通过 Resume 操作恢复,Pause 对应的Resume 在 OpenStack 内部叫做 Unpause ; Suspend 对应的Resume 才是真正的 Resume,这个在日志中能体现出来。
 
操作流程和前面的练习是一样的,这里就不详细分析了
 
 
 
Rescue / Unrescue
 
这节开始我们将讨论几种 instance 故障恢复的方法,不同方法适用于不同的场景。首先我们考虑操作系统故障。
 
有时候由于误操作或者突然断电,操作系统重启后起不来了。为了更大限度挽救数据,我们通常会使用一张系统盘将系统引导起来,然后再尝试恢复。问题如果不太严重,完全可以通过这种方式让系统重新运行起来,比如某个系统文件被意外删除,root密码遗忘等。Nova也提供这种故障恢复机制,叫Rescue。我们来看下Rescue的说明:
 
stack@DevStack-Controller:~$ nova help rescue
usage: nova rescue [--password <password>] [--image <image>] <server>
 
Reboots a server into rescue mode, which starts the machine from either the
initial image or a specified image, attaching the current boot disk as
secondary.
 
#    重启系统从启动盘的初始状态或者是一个指定的启动盘文件启动,进入救援模式,并添加故障的启动盘位第二硬盘。
 
Positional arguments:
  <server>               Name or ID of server.
 
Optional arguments:
  --password <password>  The admin password to be set in the rescue environment.     #    设置救援模式中admin的密码
  --image <image>        The image to rescue with.    #    指定一个其他的启动盘文件
 
 
目前 Rescue 操作只能在命令行中执行,当系统修复完毕后,使用 Unrescue 将 instance恢复至正常状态。
 
stack@DevStack-Controller:~$ nova help unrescue
usage: nova unrescue <server>
 
Restart the server from normal boot disk again.
 
Positional arguments:
  <server>  Name or ID of server.
 
该操作的实现流程与之前的练习一样,这里不再做详细分析
posted @ 2019-05-24 23:43  三角形  阅读(663)  评论(0编辑  收藏  举报