gpt4 book ai didi

console - 如何访问 GCE 虚拟机实例的控制台?

转载 作者:行者123 更新时间:2023-12-03 21:34:32 26 4
gpt4 key购买 nike

如何访问 Google Compute Engine 虚拟机实例的控制台?

最佳答案

要查看控制台输出(只读),您可以使用以下任何一种方法:

  • Web UI 通过 Developers Console – 在实例详细信息页面上,滚动到页面底部并展开控制台输出 View
  • CLI 通过 gcloud compute instances get-serial-port-output
  • API 通过 getSerialPortOutput

  • 要获得读/写(交互式)访问权限,请按照 this page 上的说明进行操作。 :

    gcloud compute instances add-metadata [INSTANCE_NAME] \
    --metadata=serial-port-enable=1


    然后,根据 the same page ,要么通过 Google Cloud Console 连接:

    Go to the VM instances page.

    1. Go to the GCE VM instances page
    2. Click the instance you want to connect to.
    3. Scroll to the bottom of the page and look for the Serial port section.
    4. If you want to connect to a serial port other than the default serial port 1, click the down arrow next to the Connect to serial port button and change the port number accordingly.
    5. Click the Connect to serial port button to connect to port 1 by default. For Windows instances, pull down the dropdown menu next to the button and connect to Port 2 to access the serial console.


    或者,通过 gcloud 连接:

    Use the gcloud compute connect-to-serial-port subcommand to connect using the gcloud command-line tool. For example:

    gcloud compute connect-to-serial-port [INSTANCE_NAME]

    where [INSTANCE_NAME] is the name of the instance for which you want to access the serial console.

    By default, the connect-to-serial-port command connects to port 1 of the serial console. If you are connecting to a Windows VM instance, connect to port 2 instead:

    gcloud compute connect-to-serial-port [INSTANCE_NAME] --port 2

    To connect to any other port, provide a different port number using the --port flag. You can provide a port number from 1 through 4, inclusively. To learn more about port numbers, see Understanding serial port numbering.

    关于console - 如何访问 GCE 虚拟机实例的控制台?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27734763/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com