Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Linux
Windows
Untuk memindahkan VM tenant tunggal ke node atau grup node lain, Anda dapat memulai migrasi langsung secara manual. Anda juga dapat memulai migrasi langsung secara manual untuk memindahkan VM multi-tenant ke tenancy tunggal. Untuk mengetahui informasi tentang cara memindahkan VM dari tenancy tunggal, lihat Memindahkan VM dari tenancy tunggal.
Sebelum memulai
Jika Anda belum melakukannya, siapkan autentikasi.
Autentikasi adalah
proses yang digunakan untuk memverifikasi identitas Anda untuk mengakses Google Cloud layanan dan API.
Untuk menjalankan kode atau sampel dari lingkungan pengembangan lokal, Anda dapat melakukan autentikasi ke
Compute Engine dengan memilih salah satu opsi berikut:
Select the tab for how you plan to use the samples on this page:
gcloud
Menginstal Google Cloud CLI.
Setelah penginstalan,
lakukan inisialisasi Google Cloud CLI dengan menjalankan perintah berikut:
Permintaan migrasi langsung manual dikategorikan dalam Batas kapasitas APIKueri.
Melakukan migrasi langsung VM secara manual ke atau dalam sole-tenancy
Untuk memigrasikan VM secara manual ke atau dalam tenancy tunggal, gunakan
gcloud CLI atau REST.
Jika tujuan VM adalah grup node, Compute Engine akan memilih node dalam grup yang memiliki cukup ruang untuk VM dan dengan jumlah kapasitas cadangan paling sedikit.
Anda tidak dapat melakukan migrasi langsung antar-project saat menggunakan grup sole-tenant node bersama.
Izin yang diperlukan untuk langkah ini
Untuk melakukan tugas ini, Anda harus memiliki izin berikut:
VM_NAME: nama VM yang akan diperbarui label afinitas
nodenya.
Ganti hanya salah satu dari berikut ini:
NODE: nama node tempat tujuan migrasi VM
langsung.
NODE_GROUP: nama grup node tempat migrasi VM berlangsung
secara langsung.
NODE_AFFINITY_FILE: nama file JSON
yang berisi konfigurasi node tempat VM ini dapat dijadwalkan.
Untuk mengetahui informasi selengkapnya, lihat Mengonfigurasi label
afinitas node.
REST
Untuk memigrasikan VM secara manual ke atau dalam tenancy tunggal, gunakan metode instances.update berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[[["\u003cp\u003eManual live migration can move sole-tenant VMs to a different node or node group, and multi-tenant VMs into sole-tenancy.\u003c/p\u003e\n"],["\u003cp\u003ePerforming manual live migration requires \u003ccode\u003ecompute.instances.update\u003c/code\u003e permissions on the VM.\u003c/p\u003e\n"],["\u003cp\u003eThe gcloud CLI or REST can be used to manually live migrate VMs into or within sole-tenancy, using the \u003ccode\u003egcloud compute instances update\u003c/code\u003e command or the \u003ccode\u003einstances.update\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eWhen a node group is the destination, Compute Engine selects the node with sufficient space and the least spare capacity.\u003c/p\u003e\n"],["\u003cp\u003eLive migration between projects using shared sole-tenant node groups is not supported.\u003c/p\u003e\n"]]],[],null,["# Manually live migrate VMs\n\nLinux Windows\n\n*** ** * ** ***\n\nTo move sole-tenant VMs to a different node or node group, you can manually\ninitiate a live migration. You can also manually initiate a live migration to\nmove a multi-tenant VM into sole-tenancy. For information about how to move a VM\nout of sole-tenancy, see [Move a VM out of sole-tenancy](/compute/docs/nodes/updating-vm-tenancy#moving_a_vm_out_of_sole-tenancy).\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\nAPI rate limits\n---------------\n\nManual live migration requests are categorized in the **Queries** [API rate\nlimit](/compute/docs/api-rate-limits).\n\nManually live migrate VMs into or within sole-tenancy\n-----------------------------------------------------\n\nTo manually live migrate VMs into or within sole-tenancy, use the\ngcloud CLI or REST.\n\nIf the destination of the VM is a node group, Compute Engine selects\nthe node within the group that has both enough space for the VM and the least\namount of spare capacity.\n\nYou cannot perform live migration between projects while using shared\nsole-tenant node groups.\n\n#### Permissions required for this task\n\nTo perform this task, you must have the following [permissions](/iam/docs/overview#permissions):\n\n- `compute.instances.update` permissions on the VM.\n\n### gcloud\n\nTo manually live migrate VMs into or within sole-tenancy, use the following\n[`gcloud compute instances update` command](/sdk/gcloud/reference/compute/instances/update): \n\n```\ngcloud compute instances update VM_NAME \\\n ( --node=NODE \\\n --node-group=NODE_GROUP \\\n --node-affinity-file=NODE_AFFINITY_FILE )\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM to update the node affinity labels for.\n\nReplace exactly one of the following:\n\n- \u003cvar translate=\"no\"\u003eNODE\u003c/var\u003e: the name of the node to live migrate the VM\n to.\n\n- \u003cvar translate=\"no\"\u003eNODE_GROUP\u003c/var\u003e: the name of the node group to live\n migrate the VM to.\n\n- \u003cvar translate=\"no\"\u003eNODE_AFFINITY_FILE\u003c/var\u003e: the name of a JSON file\n containing a configuration of nodes on which this VM could be scheduled.\n For more information, see [Configure node affinity\n labels](/compute/docs/nodes/provisioning-sole-tenant-vms#configure_node_affinity_labels).\n\n### REST\n\nTo manually live migrate VMs into or within sole-tenancy, use the following\n[`instances.update` method](/compute/docs/reference/rest/v1/instances/update): \n\n```\nPUT https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME\n\n{\n ...\n \"scheduling\": {\n \"nodeAffinities\": [\n {\n \"key\": \"NODE_AFFINITY_LABEL_KEY\",\n \"operator\": \"IN\",\n \"values\": [\n \"[NODE_AFFINITY_LABEL_VALUE]\"\n ]\n }\n ]\n }\n ...\n}\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project that has the VM\n to update the node affinity labels for.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone of the VM to update the node\n affinity labels for.\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM to update the node\n affinity labels for.\n\n- \u003cvar translate=\"no\"\u003eNODE_AFFINITY_LABEL_KEY\u003c/var\u003e: one of the following\n strings that specifies whether to live migrate the VM to a node group or\n node:\n\n- \u003cvar translate=\"no\"\u003eNODE_AFFINITY_LABEL_VALUE\u003c/var\u003e: the name of the node\n group or node to live migrate the VM to.\n\nWhat's next\n-----------\n\n- [Learn how to move a VM out of sole-tenancy](/compute/docs/nodes/updating-vm-tenancy#moving_a_vm_out_of_sole-tenancy)"]]