克隆现有机器
编辑克隆现有机器
编辑为了在多个节点上构建集群,您可以将已配置的实例克隆到新的节点。您无需重新安装所有内容!
首先创建正在运行实例的镜像并将其上传到 Google Cloud Storage
# Create an image of your current instance sudo /usr/bin/gcimagebundle -d /dev/sda -o /tmp/ # An image has been created in `/tmp` directory: ls /tmp e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz # Upload your image to Google Cloud Storage: # Create a bucket to hold your image, let's say `esimage`: gsutil mb gs://esimage # Copy your image to this bucket: gsutil cp /tmp/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz gs://esimage # Then add your image to images collection: gcloud compute images create elasticsearch-2-0-0 --source-uri gs://esimage/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz # If the previous command did not work for you, logout from your instance # and launch the same command from your local machine.
启动新实例
编辑现在您有了镜像,您可以根据需要创建任意数量的实例。
# Just change node name (here myesnode2) gcloud compute instances create myesnode2 --image elasticsearch-2-0-0 --zone europe-west1-a # If you want to provide all details directly, you can use: gcloud compute instances create myesnode2 --image=elasticsearch-2-0-0 \ --zone europe-west1-a --machine-type f1-micro --scopes=compute-rw
移除实例(也称为关闭实例)
编辑您可以使用 Google Cloud Console 或 CLI 来管理您的实例。
# Stopping and removing instances gcloud compute instances delete myesnode1 myesnode2 \ --zone=europe-west1-a # Consider removing disk as well if you don't need them anymore gcloud compute disks delete boot-myesnode1 boot-myesnode2 \ --zone=europe-west1-a