zoukankan      html  css  js  c++  java
  • virtualbox+vagrant学习-2(command cli)-16-vagrant snapshot命令

    Snapshot快照

    这是用于管理客户机器快照的命令。快照记录客户计算机的时间点状态。然后可以快速恢复到此环境。这可以让你进行试验和尝试,并迅速恢复到以前的状态。

    快照并不是每个provider都支持的。如果不支持,Vagrant会给你一条错误消息。

    1)Snapshot Push

    格式:

    vagrant snapshot push [options] [vm-name]

    这将获取快照并将其推入快照堆栈。

    这是在不需要指定名称的地方运行vagrant snapshot save命令的简写

    userdeMacBook-Pro:~ user$ vagrant snapshot push -h
    Usage: vagrant snapshot push [options] [vm-name]
    
    Take a snapshot of the current state of the machine and 'push' it onto the stack of states. You can use `vagrant snapshot pop` to restore back to this state at any time.
    获取机器当前状态的快照,并将其“push”到状态堆栈上。你可以使用“vagrant snapshot pop”命令在任何时候恢复到此状态。
    
    If you use `vagrant snapshot save` or restore at any point after a push, pop will still bring you back to this pushed state.
    如果你在push后的任何时间使用“vagrant snapshot save”或“vagrant snapshot restore”,pop命令仍然会将你带回这个push状态。
    
        -h, --help                       Print this help 打印帮助信息

    ⚠️如果你使用的是push和pop,请避免使用save和restore,因为混合使用它们是不安全的。

    2)Snapshot Pop

    格式:

    vagrant snapshot pop [options] [vm-name]

    这个命令与vagrant snapshot push命令相反:它将恢复被推送的状态。

    userdeMacBook-Pro:~ user$ vagrant snapshot pop -h
    Usage: vagrant snapshot pop [options] [vm-name]
     
            --[no-]provision             Enable or disable provisioning  启用或不使用预配置程序
            --provision-with x,y,z       Enable only certain provisioners, by type or by name.
                                         通过类型或名字来只启用某些预配置程序
    Restore state that was pushed with `vagrant snapshot push`. 恢复使用`vagrant snapshot push`命令推入的状态
            --no-delete                  Don't delete the snapshot after the restore 恢复后不删除快照
        -h, --help                       Print this help 打印帮助信息

    3)Snapshot Save

    格式:

    vagrant snapshot save [options] [vm-name] <name>

    这个命令保存了一个新的命名快照。如果使用此命令,则无法安全使用push和pop子命令。

    userdeMacBook-Pro:~ user$ vagrant snapshot save -h
    Usage: vagrant snapshot save [options] [vm-name] <name>
    
    Take a snapshot of the current state of the machine. The snapshot can be restored via `vagrant snapshot restore` at any point in the future to get back to this exact machine state.
    获取机器当前状态的快照。快照可以通过`vagrant snapshot restore`命令在未来的任何时间恢复到这个机器的确切状态。
    
    Snapshots are useful for experimenting in a machine and being able to rollback quickly.
    快照对于在机器中进行试验和能够快速回滚非常有用。 
        -f, --force                      Replace snapshot without confirmation 强制执行
        -h, --help                       Print this help 打印帮助信息

    4)Snapshot Restore

    格式:

    vagrant snapshot restore [options] [vm-name] <name>

    此命令还原指定的快照。

    userdeMacBook-Pro:~ user$ vagrant snapshot restore -h
    Usage: vagrant snapshot restore [options] [vm-name] <name>
    
            --[no-]provision             Enable or disable provisioning 启用或不使用预配置程序
            --provision-with x,y,z       Enable only certain provisioners, by type or by name.
                                         通过类型或名字来只启用某些预配置程序
    Restore a snapshot taken previously with snapshot save.
    恢复以前使用snapshot save命令所获取的快照。
        -h, --help                       Print this help 打印帮助信息

    5)Snapshot List

    格式:

    vagrant snapshot list [options] [vm-name]

    这个命令将列出取得的所有快照。

    userdeMacBook-Pro:~ user$ vagrant snapshot list -h
    Usage: vagrant snapshot list [options] [vm-name]
    
    List all snapshots taken for a machine. 列举从机器中得到的所有快照
        -h, --help                       Print this help 打印帮助信息

    6)Snapshot Delete

    格式:

    vagrant snapshot delete [options] [vm-name] <name>

    这个命令将删除指定的快照

    有些providers要求首先删除所有“子”快照。vagrant本身并不追踪这些“子”快照是什么。如果是这种情况(例如在VirtualBox中),那么必须确保以相反的顺序删除快照。

    如果机器在快照之前停止,这个快照命令通常会快得多。

    如果这不是一个选项,或者不是理想的,那么删除也可以通过大多数providers在线完成。

    userdeMacBook-Pro:~ user$ vagrant snapshot delete -h
    Usage: vagrant snapshot delete [options] [vm-name] <name>
    
    Delete a snapshot taken previously with snapshot save. 删除之前使用with snapshot save命令获取的快照
        -h, --help                       Print this help 打印帮助信息
  • 相关阅读:
    iframe
    go web
    go 算法与数据结构
    go redis
    go 网络编程
    go 并发编程
    go 序列化
    go 文件操作
    go 面向对象
    go 环境及4开发
  • 原文地址:https://www.cnblogs.com/wanghui-garcia/p/10170486.html
Copyright © 2011-2022 走看看