Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Diese Seite enthält Best Practices für das Ausführen von RPC-Knoten in mehreren Blockchain-Netzwerken.
Insbesondere führt Sie diese Anleitung durch folgende Schritte:
Erstellen Sie eine neue VPC für Ihren Knoten.
Eine VM für Ihren Knoten starten.
Ein neues Profil für den Knotenmanager einrichten
Binden Sie ein externes Laufwerk für die Kettendaten an die VM an.
In dieser Anleitung wird davon ausgegangen, dass Sie bereits ein Google Cloud-Projekt mit aktivierter Abrechnung haben.
Eine Anleitung dazu finden Sie im Hilfeartikel Projekte erstellen und verwalten.
Erstellen Sie ein VPC für Ihren Knoten gemäß den folgenden Empfehlungen:
Benutzerdefiniertes VPC erstellen
Regionaler Routingmodus
MTU 1460
Aktivieren Sie die Standard-BLOCKCHAIN_VPC_NETWORK-allow-ssh-Firewallregel für Ihr Netzwerk. Weitere Informationen finden Sie unter VPC-Firewallregeln verwenden.
Ersetzen Sie BLOCKCHAIN_VPC_NETWORK durch den Namen des VPC, in dem sich Ihre Knotenressourcen befinden sollen, z. B. ethereum-vpc.
Informationen zum Erstellen von Firewallregeln für VMs in einer VPC finden Sie unter VPC-Firewallregeln erstellen.
VM mit einem externen SSD starten
Eine detaillierte Anleitung zum Erstellen einer VM und zum Anschließen eines externen Laufwerks finden Sie in der Compute Engine-Dokumentation.
Spezifische Anweisungen für die VM-Form, die den spezifischen Anforderungen des Blockchain-Netzwerks entspricht, finden Sie auf der blockchainspezifischen Knotenseite im Abschnitt Hardware Requirements and Recommended Machine Type. In der blockchainspezifischen Dokumentation finden Sie die CPU- und Arbeitsspeicheranforderungen, die empfohlene VM-Konfiguration für Ihren Knoten und die Erstellungsbefehle für Ihren Knoten.
Über SSH eine Verbindung zur VM herstellen und einen neuen Nutzer erstellen
Eine SSH-Verbindung zur VM herstellen:
Stellen Sie nach der Bereitstellung der VM eine SSH-Verbindung her. Rufen Sie dazu entweder die Seite der Compute Engine auf oder führen Sie den folgenden Befehl in Cloud Shell aus:
gcloudcomputesshNODE_NAME
Ersetzen Sie NODE_NAME durch Ihren Ingress-Namen. Verwenden Sie Kleinbuchstaben, Ziffern und Bindestriche. Beispiel: my-node
Wenn Sie eine Verbindung von Ihrem eigenen Computer herstellen, installieren Sie die Google Cloud CLI wie unter gcloud CLI installieren beschrieben.
Wenn die Installation der Google Cloud CLI abgeschlossen ist, melden Sie sich in Ihrem Projekt an und stellen Sie eine Verbindung zur VM her:
gcloudinitgcloudcomputesshUSER@NODE_NAME
Ersetzen Sie USER durch den Anmeldenamen Ihres Google Cloud Nutzers.
Neuen Nutzer erstellen
Nachdem Sie eine SSH-Verbindung zur VM hergestellt haben, erstellen Sie einen nicht SSH-Sudo-Nutzer, der alle Ressourcen für den Knoten besitzt und verwaltet. Da dieser Nutzer keine SSH-Schlüssel in den VM-Metadaten hat, kann nur dann darauf zugegriffen werden, wenn zuerst über einen der authentifizierten Google Cloud -Nutzer eine Verbindung zum Computer hergestellt wird.
Erstellen Sie einen neuen Sudo-Nutzer:
sudouseradd-mNODE_ADMIN
Ersetzen Sie NODE_ADMIN durch die Nutzer-ID des neuen Nutzers. Beispiel: node-admin.
Fügen Sie den Nutzer der Gruppe „sudo“ hinzu:
sudousermod-aGsudoNODE_ADMIN
Wechseln Sie zu diesem Nutzer, um das externe Laufwerk bereitzustellen:
sudosu-NODE_ADMIN
Externe Laufwerke bereitstellen
Auf dem externen Laufwerk, das Sie in Schritt 2 erstellt haben, werden alle Kettendaten für Ihren Knoten gespeichert. Dies ist eine Best Practice, da Sie die Daten nach dem Herunterfahren der VM zwischen Knoten verschieben und Snapshot-Zeitpläne für Ihre Kettendaten ganz einfach konfigurieren können.
Stellen Sie das Laufwerk bereit und listen Sie zuerst alle verfügbaren Laufwerke in der VM auf:
sudolsblk
Höchstwahrscheinlich finden Sie das externe Laufwerk unter /dev/sdb. Sie können das externe Laufwerk an der Größe des Laufwerks erkennen, das Sie in Schritt 2 erstellen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThis guide provides best practices for setting up RPC nodes across various blockchain networks within a Google Cloud environment.\u003c/p\u003e\n"],["\u003cp\u003eThe tutorial covers creating a custom VPC with regional routing and specific MTU settings, along with the creation of necessary firewall rules for the node.\u003c/p\u003e\n"],["\u003cp\u003eIt also details the process of spinning up a VM, connecting via SSH, and creating a dedicated non-SSH sudo user for node management.\u003c/p\u003e\n"],["\u003cp\u003eInstructions are provided for mounting an external SSD disk to the VM, which is essential for storing blockchain data and allowing for easy portability and snapshot configuration.\u003c/p\u003e\n"],["\u003cp\u003eAfter following this guide, users will have a configured VPC, a VM, a dedicated user, and a mounted disk, ready for the blockchain-specific deployment commands as outlined in the respective documentation.\u003c/p\u003e\n"]]],[],null,["# Common self-managed node setup\n\nThis page contains best practices for running RPC nodes across multiple blockchain networks.\n\nSpecifically, this tutorial will walk you through:\n\n- Creating a new VPC for your node.\n- Spinning up a VM for your node.\n- Setting up a new profile for your node manager.\n- Mounting an external disk to the VM for the chain data.\n\n**This guide assumes you already have a Google Cloud project with billing enabled.**\nFor instructions on how to do this, see [Creating and managing projects](/resource-manager/docs/creating-managing-projects).\n\nCreate a new VPC\n----------------\n\nFor detailed instructions on VPC creation, see [Create and manage VPC networks](/vpc/docs/create-modify-vpc-networks).\n\n1. Create a VPC for your node following these recommendations:\n\n - Create a custom VPC\n - Regional routing mode\n - MTU 1460\n - Enable the default \u003cvar translate=\"no\"\u003eBLOCKCHAIN_VPC_NETWORK\u003c/var\u003e`-allow-ssh` firewall rule for your network. See [Use VPC firewall rules](/firewall/docs/using-firewalls#common-use-cases-allow-ssh) for more.\n\n Replace \u003cvar translate=\"no\"\u003eBLOCKCHAIN_VPC_NETWORK\u003c/var\u003e with the name of the VPC that will hold your node resources, for example `ethereum-vpc`.\n2. [Add an IPv4 subnet](/vpc/docs/create-modify-vpc-networks#add-subnets) for your network. **Make sure the region chosen for your subnet is the same region where you want to deploy your node.**\n\n| **Note:** Refer to VPC and networking requirements in each blockchain-specific node page to see the required ports you need to enable for the VMs in the VPC.\n\nTo learn how to create firewall rules VMs in a VPC, see [Create VPC firewall rules](/firewall/docs/using-firewalls#creating_firewall_rules).\n\nSpin up a VM with an external SSD\n---------------------------------\n\nFor detailed instructions on VM creation and external disk attachment, [see the Compute Engine documentation](/compute/docs/instances/create-start-instance#create_a_vm_instance_with_additional_non-boot_disks).\n\nSpecific instructions for the VM shape that matches the specific requirements for the blockchain network can be found under the `Hardware Requirements and Recommended Machine Type` section in the blockchain-specific node page. Refer to the blockchain-specific documentation to see the CPU and memory requirements, recommended VM shape for your node, and creation commands for your node.\n\nConnect to the VM using SSH and create a new user\n-------------------------------------------------\n\n### Connect to the VM using SSH\n\n1. When the VM is provisioned, connect to the VM using SSH by either navigating to the compute engine page, or by running the following command in [Cloud Shell](/shell/docs/launching-cloud-shell):\n\n gcloud compute ssh \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eNODE_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNODE_NAME\u003c/var\u003e with the name of your node. Use lowercase letters, numbers, and hyphens. For example: `my-node`.\n2. If connecting from your own machine, install the Google Cloud CLI as described in [Install the gcloud CLI](https://cloud.google.com/sdk/docs/install).\n\n3. When the Google Cloud CLI installation is complete, login to your project and connect to the VM:\n\n gcloud init\n gcloud compute ssh \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eUSER\u003c/span\u003e\u003c/var\u003e@\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eNODE_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eUSER\u003c/var\u003e with your Google Cloud user login name.\n\n### Create a new user\n\nOnce you have connected to the VM via SSH, create a non-SSH sudo user to own and administrate all the resources for the node. Since this user does not have SSH keys in the VM metadata, it can only be accessed by connecting to the machine first via one of the authenticated Google Cloud users.\n\n1. Create a new sudo user, run:\n\n sudo useradd -m \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eNODE_ADMIN\u003c/span\u003e\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNODE_ADMIN\u003c/var\u003e with the user ID of the new user. For example, `node-admin`.\n2. Add the user to the sudo group:\n\n sudo usermod -aG sudo \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eNODE_ADMIN\u003c/span\u003e\u003c/var\u003e\n\n3. Switch to this user to finish mounting the external disk:\n\n sudo su - \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eNODE_ADMIN\u003c/span\u003e\u003c/var\u003e\n\nMount the external disks\n------------------------\n\nThe external disk you created in [step 2](#step2) will house all the chain data for your node. This is a best practice since it allows you to port the data across nodes once the VM is shutdown, as well as [easily configure snapshot schedules](/compute/docs/disks/scheduled-snapshots) for your chain data.\n\n1. Mount your disk, first list all the available disks in the VM:\n\n sudo lsblk\n\n Most likely, the external disk will be found under `/dev/sdb`. You can tell the external disk by the size of the disk you create in [step 2](#step2).\n2. Format the disk:\n\n sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003edev\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003esdb\u003c/span\u003e\u003c/var\u003e\n\n3. Create a directory for the disk and mount it:\n\n sudo mkdir -p /mnt/disks/\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eCHAIN_DATA_NAME\u003c/span\u003e\u003c/var\u003e\n sudo mount -o discard,defaults \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003edev\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003esdb\u003c/span\u003e\u003c/var\u003e /mnt/disks/\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eCHAIN_DATA_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCHAIN_DATA_NAME\u003c/var\u003e: the name of the data directory for your chain. For example, `my-eth-data`.\n - \u003cvar translate=\"no\"\u003e/dev/sdb\u003c/var\u003e: the location of the disk if different than `/dev/sdb`.\n4. Assign write privileges to \u003cvar translate=\"no\"\u003eNODE_ADMIN\u003c/var\u003e:\n\n sudo chmod a+w /mnt/disks/\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eCHAIN_DATA_NAME\u003c/span\u003e\u003c/var\u003e\n\n5. Get the UUID of the disk and add it to `fstab` for automatic remounting on restart:\n\n sudo blkid \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003edev\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003esdb\u003c/span\u003e\u003c/var\u003e\n export DISK_UUID=$(findmnt -n -o UUID \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003edev\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e/\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003esdb\u003c/span\u003e\u003c/var\u003e)\n echo \"UUID=$DISK_UUID /mnt/disks/\u003cvar translate=\"no\"\u003eCHAIN_DATA_NAME\u003c/var\u003e ext4 discard,defaults,nofail 0 2\" | sudo tee -a /etc/fstab\n\n6. Your disk is now mounted and ready. To check your mounted disk, run:\n\n df -h\n\nWhat's next?\n------------\n\nThe skeleton of your node is ready to go. By this point, you should have:\n\n- A VPC for your node with SSH access enabled.\n- A VM fitted to the requirements of your node.\n- A new node admin user to own and manage node resources.\n- A mounted external SSD disk fitted to the storage requirements of your node.\n\nMake sure to go back to the blockchain-specific documentation to finish running the deployment commands for your node."]]