2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce]]
|
|
|
|
=== GCE Discovery Plugin
|
2015-08-15 12:00:55 -04:00
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
The Google Compute Engine Discovery plugin uses the GCE API for unicast discovery.
|
2015-08-15 12:00:55 -04:00
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-install]]
|
2015-08-15 12:00:55 -04:00
|
|
|
[float]
|
|
|
|
==== Installation
|
|
|
|
|
|
|
|
This plugin can be installed using the plugin manager:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
----------------------------------------------------------------
|
2016-02-04 10:00:55 -05:00
|
|
|
sudo bin/elasticsearch-plugin install discovery-gce
|
2015-08-15 12:00:55 -04:00
|
|
|
----------------------------------------------------------------
|
|
|
|
|
|
|
|
The plugin must be installed on every node in the cluster, and each node must
|
|
|
|
be restarted after installation.
|
|
|
|
|
2016-09-19 09:04:29 -04:00
|
|
|
This plugin can be downloaded for <<plugin-management-custom-url,offline install>> from
|
|
|
|
{plugin_url}/discovery-gce/{version}/discovery-gce-{version}.zip.
|
2016-09-12 09:34:44 -04:00
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-remove]]
|
2015-08-15 12:00:55 -04:00
|
|
|
[float]
|
|
|
|
==== Removal
|
|
|
|
|
|
|
|
The plugin can be removed with the following command:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
----------------------------------------------------------------
|
2016-02-04 10:00:55 -05:00
|
|
|
sudo bin/elasticsearch-plugin remove discovery-gce
|
2015-08-15 12:00:55 -04:00
|
|
|
----------------------------------------------------------------
|
|
|
|
|
|
|
|
The node must be stopped before removing the plugin.
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== GCE Virtual Machine Discovery
|
|
|
|
|
|
|
|
Google Compute Engine VM discovery allows to use the google APIs to perform automatic discovery (similar to multicast
|
|
|
|
in non hostile multicast environments). Here is a simple sample configuration:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
cloud:
|
|
|
|
gce:
|
|
|
|
project_id: <your-google-project-id>
|
|
|
|
zone: <your-zone>
|
|
|
|
discovery:
|
|
|
|
type: gce
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-21 04:06:32 -04:00
|
|
|
The following gce settings (prefixed with `cloud.gce`) are supported:
|
|
|
|
|
2016-02-16 15:40:53 -05:00
|
|
|
`project_id`::
|
|
|
|
|
|
|
|
Your Google project id (mandatory).
|
|
|
|
|
|
|
|
`zone`::
|
|
|
|
|
|
|
|
helps to retrieve instances running in a given zone (mandatory). It should be one of the
|
|
|
|
https://developers.google.com/compute/docs/zones#available[GCE supported zones].
|
|
|
|
See also <<discovery-gce-usage-zones>>.
|
|
|
|
|
2015-09-21 04:06:32 -04:00
|
|
|
`retry`::
|
|
|
|
|
|
|
|
If set to `true`, client will use
|
|
|
|
https://developers.google.com/api-client-library/java/google-http-java-client/backoff[ExponentialBackOff]
|
|
|
|
policy to retry the failed http request. Defaults to `true`.
|
|
|
|
|
|
|
|
`max_wait`::
|
|
|
|
|
2016-02-16 15:40:53 -05:00
|
|
|
The maximum elapsed time after the client instantiating retry. If the time elapsed goes past the
|
|
|
|
`max_wait`, client stops to retry. A negative value means that it will wait indefinitely. Defaults to `0s` (retry
|
|
|
|
indefinitely).
|
|
|
|
|
|
|
|
`refresh_interval`::
|
|
|
|
|
|
|
|
How long the list of hosts is cached to prevent further requests to the GCE API. `0s` disables caching.
|
|
|
|
A negative value will cause infinite caching. Defaults to `0s`.
|
2015-09-21 04:06:32 -04:00
|
|
|
|
2015-09-16 06:56:28 -04:00
|
|
|
|
|
|
|
[IMPORTANT]
|
|
|
|
.Binding the network host
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
It's important to define `network.host` as by default it's bound to `localhost`.
|
|
|
|
|
|
|
|
You can use {ref}/modules-network.html[core network host settings] or
|
|
|
|
<<discovery-gce-network-host,gce specific host settings>>:
|
|
|
|
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
[[discovery-gce-network-host]]
|
|
|
|
==== GCE Network Host
|
|
|
|
|
2015-10-08 02:53:54 -04:00
|
|
|
When the `discovery-gce` plugin is installed, the following are also allowed
|
2015-09-16 06:56:28 -04:00
|
|
|
as valid network host settings:
|
|
|
|
|
|
|
|
[cols="<,<",options="header",]
|
|
|
|
|==================================================================
|
|
|
|
|GCE Host Value |Description
|
|
|
|
|`_gce:privateIp:X_` |The private IP address of the machine for a given network interface.
|
|
|
|
|`_gce:hostname_` |The hostname of the machine.
|
|
|
|
|`_gce_` |Same as `_gce:privateIp:0_` (recommended).
|
|
|
|
|==================================================================
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
# get the IP address from network interface 1
|
|
|
|
network.host: _gce:privateIp:1_
|
|
|
|
# shortcut for _gce:privateIp:0_
|
|
|
|
network.host: _gce_
|
|
|
|
# Using GCE internal hostname (recommended)
|
|
|
|
network.host: _gce:hostname_
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-short]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== How to start (short story)
|
|
|
|
|
|
|
|
* Create Google Compute Engine instance (with compute rw permissions)
|
|
|
|
* Install Elasticsearch
|
|
|
|
* Install Google Compute Engine Cloud plugin
|
|
|
|
* Modify `elasticsearch.yml` file
|
|
|
|
* Start Elasticsearch
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-long]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== Setting up GCE Discovery
|
|
|
|
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-long-prerequisites]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== Prerequisites
|
|
|
|
|
|
|
|
Before starting, you need:
|
|
|
|
|
|
|
|
* Your project ID, e.g. `es-cloud`. Get it from https://code.google.com/apis/console/[Google API Console].
|
|
|
|
* To install https://developers.google.com/cloud/sdk/[Google Cloud SDK]
|
|
|
|
|
|
|
|
If you did not set it yet, you can define your default project you will work on:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
gcloud config set project es-cloud
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-long-login]]
|
|
|
|
===== Login to Google Cloud
|
2015-08-15 12:00:55 -04:00
|
|
|
|
2015-09-15 16:37:29 -04:00
|
|
|
If you haven't already, login to Google Cloud
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud auth login
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-15 16:37:29 -04:00
|
|
|
This will open your browser. You will be asked to sign-in to a Google account and
|
|
|
|
authorize access to the Google Cloud SDK.
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-long-first-instance]]
|
2015-09-15 16:37:29 -04:00
|
|
|
===== Creating your first instance
|
2015-08-15 12:00:55 -04:00
|
|
|
|
2015-09-15 16:37:29 -04:00
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
gcloud compute instances create myesnode1 \
|
|
|
|
--zone <your-zone> \
|
|
|
|
--scopes compute-rw
|
|
|
|
--------------------------------------------------
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
When done, a report like this one should appears:
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
--------------------------------------------------
|
2015-09-15 16:37:29 -04:00
|
|
|
Created [https://www.googleapis.com/compute/v1/projects/es-cloud-1070/zones/us-central1-f/instances/myesnode1].
|
|
|
|
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
|
|
|
|
myesnode1 us-central1-f n1-standard-1 10.240.133.54 104.197.94.25 RUNNING
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
You can now connect to your instance:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
# Connect using google cloud SDK
|
|
|
|
gcloud compute ssh myesnode1 --zone europe-west1-a
|
|
|
|
|
|
|
|
# Or using SSH with external IP address
|
|
|
|
ssh -i ~/.ssh/google_compute_engine 192.158.29.199
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
[IMPORTANT]
|
|
|
|
.Service Account Permissions
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
It's important when creating an instance that the correct permissions are set. At a minimum, you must ensure you have:
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
--------------------------------------------------
|
2015-09-15 16:37:29 -04:00
|
|
|
scopes=compute-rw
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Failing to set this will result in unauthorized messages when starting Elasticsearch.
|
2015-10-08 01:04:11 -04:00
|
|
|
See <<discovery-gce-usage-tips-permissions>>.
|
2015-08-15 12:00:55 -04:00
|
|
|
==============================================
|
|
|
|
|
|
|
|
|
|
|
|
Once connected, install Elasticsearch:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
sudo apt-get update
|
|
|
|
|
|
|
|
# Download Elasticsearch
|
|
|
|
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-2.0.0.deb
|
|
|
|
|
2015-10-07 15:40:36 -04:00
|
|
|
# Prepare Java installation (Oracle)
|
|
|
|
sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/webupd8team-java.list
|
|
|
|
sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
|
|
|
|
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install oracle-java8-installer
|
|
|
|
|
|
|
|
# Prepare Java installation (or OpenJDK)
|
|
|
|
# sudo apt-get install java8-runtime-headless
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
# Prepare Elasticsearch installation
|
|
|
|
sudo dpkg -i elasticsearch-2.0.0.deb
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-long-install-plugin]]
|
|
|
|
===== Install elasticsearch discovery gce plugin
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
Install the plugin:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
# Use Plugin Manager to install it
|
2016-02-04 10:00:55 -05:00
|
|
|
sudo bin/elasticsearch-plugin install discovery-gce
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Open the `elasticsearch.yml` file:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
sudo vi /etc/elasticsearch/elasticsearch.yml
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
And add the following lines:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
cloud:
|
|
|
|
gce:
|
|
|
|
project_id: es-cloud
|
|
|
|
zone: europe-west1-a
|
|
|
|
discovery:
|
|
|
|
type: gce
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
Start elasticsearch:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
sudo /etc/init.d/elasticsearch start
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
If anything goes wrong, you should check logs:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
tail -f /var/log/elasticsearch/elasticsearch.log
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2016-08-31 15:51:52 -04:00
|
|
|
If needed, you can change log level to `trace` by opening `log4j2.properties`:
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
2016-08-31 15:51:52 -04:00
|
|
|
sudo vi /etc/elasticsearch/log4j2.properties
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
and adding the following line:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
# discovery
|
2016-08-31 15:51:52 -04:00
|
|
|
logger.discovery_gce.name = discovery.gce
|
|
|
|
logger.discovery_gce.level = trace
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-cloning]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== Cloning your existing machine
|
|
|
|
|
|
|
|
In order to build a cluster on many nodes, you can clone your configured instance to new nodes.
|
|
|
|
You won't have to reinstall everything!
|
|
|
|
|
|
|
|
First create an image of your running instance and upload it to Google Cloud Storage:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
2015-10-07 15:40:36 -04:00
|
|
|
# Create an image of your current instance
|
2015-08-15 12:00:55 -04:00
|
|
|
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:
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute images create elasticsearch-2-0-0 --source-uri gs://esimage/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
# If the previous command did not work for you, logout from your instance
|
|
|
|
# and launch the same command from your local machine.
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-start-new-instances]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== Start new instances
|
|
|
|
|
|
|
|
As you have now an image, you can create as many instances as you need:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
# Just change node name (here myesnode2)
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute instances create myesnode2 --image elasticsearch-2-0-0 --zone europe-west1-a
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
# If you want to provide all details directly, you can use:
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute instances create myesnode2 --image=elasticsearch-2-0-0 \
|
|
|
|
--zone europe-west1-a --machine-type f1-micro --scopes=compute-rw
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-remove-instance]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== Remove an instance (aka shut it down)
|
|
|
|
|
|
|
|
You can use https://cloud.google.com/console[Google Cloud Console] or CLI to manage your instances:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
# Stopping and removing instances
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute instances delete myesnode1 myesnode2 \
|
2015-08-15 12:00:55 -04:00
|
|
|
--zone=europe-west1-a
|
|
|
|
|
|
|
|
# Consider removing disk as well if you don't need them anymore
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute disks deleted boot-myesnode1 boot-myesnode2 \
|
2015-08-15 12:00:55 -04:00
|
|
|
--zone=europe-west1-a
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-zones]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== Using GCE zones
|
|
|
|
|
|
|
|
`cloud.gce.zone` helps to retrieve instances running in a given zone. It should be one of the
|
|
|
|
https://developers.google.com/compute/docs/zones#available[GCE supported zones].
|
|
|
|
|
|
|
|
The GCE discovery can support multi zones although you need to be aware of network latency between zones.
|
|
|
|
To enable discovery across more than one zone, just enter add your zone list to `cloud.gce.zone` setting:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
cloud:
|
|
|
|
gce:
|
|
|
|
project_id: <your-google-project-id>
|
|
|
|
zone: ["<your-zone1>", "<your-zone2>"]
|
|
|
|
discovery:
|
|
|
|
type: gce
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-tags]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== Filtering by tags
|
|
|
|
|
|
|
|
The GCE discovery can also filter machines to include in the cluster based on tags using `discovery.gce.tags` settings.
|
|
|
|
For example, setting `discovery.gce.tags` to `dev` will only filter instances having a tag set to `dev`. Several tags
|
|
|
|
set will require all of those tags to be set for the instance to be included.
|
|
|
|
|
|
|
|
One practical use for tag filtering is when an GCE cluster contains many nodes that are not running
|
2016-07-21 09:03:56 -04:00
|
|
|
elasticsearch. In this case (particularly with high `discovery.zen.ping_timeout` values) there is a risk that a new
|
|
|
|
node's discovery phase will end before it has found the cluster (which will result in it declaring itself master of a
|
|
|
|
new cluster with the same name - highly undesirable). Adding tag on elasticsearch GCE nodes and then filtering by that
|
2015-08-15 12:00:55 -04:00
|
|
|
tag will resolve this issue.
|
|
|
|
|
|
|
|
Add your tag when building the new instance:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute instances create myesnode1 --project=es-cloud \
|
|
|
|
--scopes=compute-rw \
|
2015-08-15 12:00:55 -04:00
|
|
|
--tags=elasticsearch,dev
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Then, define it in `elasticsearch.yml`:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
cloud:
|
|
|
|
gce:
|
|
|
|
project_id: es-cloud
|
|
|
|
zone: europe-west1-a
|
|
|
|
discovery:
|
|
|
|
type: gce
|
|
|
|
gce:
|
|
|
|
tags: elasticsearch, dev
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-port]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== Changing default transport port
|
|
|
|
|
|
|
|
By default, elasticsearch GCE plugin assumes that you run elasticsearch on 9300 default port.
|
|
|
|
But you can specify the port value elasticsearch is meant to use using google compute engine metadata `es_port`:
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-port-create]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== When creating instance
|
|
|
|
|
2015-09-15 16:37:29 -04:00
|
|
|
Add `--metadata es_port=9301` option:
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
# when creating first instance
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute instances create myesnode1 \
|
|
|
|
--scopes=compute-rw,storage-full \
|
|
|
|
--metadata es_port=9301
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
# when creating an instance from an image
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute instances create myesnode2 --image=elasticsearch-1-0-0-RC1 \
|
|
|
|
--zone europe-west1-a --machine-type f1-micro --scopes=compute-rw \
|
|
|
|
--metadata es_port=9301
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-port-run]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== On a running instance
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud compute instances add-metadata myesnode1 \
|
|
|
|
--zone europe-west1-a \
|
|
|
|
--metadata es_port=9301
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-tips]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== GCE Tips
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-tips-projectid]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== Store project id locally
|
|
|
|
|
2015-09-15 16:37:29 -04:00
|
|
|
If you don't want to repeat the project id each time, you can save it in the local gcloud config
|
2015-08-15 12:00:55 -04:00
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
2015-09-15 16:37:29 -04:00
|
|
|
gcloud config set project es-cloud
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-tips-permissions]]
|
2015-08-15 12:00:55 -04:00
|
|
|
===== Machine Permissions
|
|
|
|
|
|
|
|
If you have created a machine without the correct permissions, you will see `403 unauthorized` error messages. The only
|
|
|
|
way to alter these permissions is to delete the instance (NOT THE DISK). Then create another with the correct permissions.
|
|
|
|
|
2015-09-15 16:37:29 -04:00
|
|
|
Creating machines with gcloud::
|
2015-08-15 12:00:55 -04:00
|
|
|
+
|
|
|
|
--
|
|
|
|
Ensure the following flags are set:
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
--------------------------------------------------
|
2015-09-15 16:37:29 -04:00
|
|
|
--scopes=compute-rw
|
2015-08-15 12:00:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
--
|
|
|
|
|
|
|
|
Creating with console (web)::
|
|
|
|
+
|
|
|
|
--
|
|
|
|
When creating an instance using the web portal, click _Show advanced options_.
|
|
|
|
|
|
|
|
At the bottom of the page, under `PROJECT ACCESS`, choose `>> Compute >> Read Write`.
|
|
|
|
--
|
|
|
|
|
|
|
|
Creating with knife google::
|
|
|
|
+
|
|
|
|
--
|
|
|
|
Set the service account scopes when creating the machine:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
knife google server create www1 \
|
|
|
|
-m n1-standard-1 \
|
2015-09-22 08:23:30 -04:00
|
|
|
-I debian-8 \
|
2015-08-15 12:00:55 -04:00
|
|
|
-Z us-central1-a \
|
|
|
|
-i ~/.ssh/id_rsa \
|
|
|
|
-x jdoe \
|
|
|
|
--gce-service-account-scopes https://www.googleapis.com/auth/compute.full_control
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Or, you may use the alias:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
--gce-service-account-scopes compute-rw
|
|
|
|
--------------------------------------------------
|
|
|
|
--
|
|
|
|
|
2015-09-26 05:53:21 -04:00
|
|
|
[[discovery-gce-usage-testing]]
|
2015-08-15 12:00:55 -04:00
|
|
|
==== Testing GCE
|
|
|
|
|
|
|
|
Integrations tests in this plugin require working GCE configuration and
|
|
|
|
therefore disabled by default. To enable tests prepare a config file
|
|
|
|
elasticsearch.yml with the following content:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
cloud:
|
|
|
|
gce:
|
|
|
|
project_id: es-cloud
|
|
|
|
zone: europe-west1-a
|
|
|
|
discovery:
|
|
|
|
type: gce
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Replaces `project_id` and `zone` with your settings.
|
|
|
|
|
|
|
|
To run test:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------------
|
|
|
|
mvn -Dtests.gce=true -Dtests.config=/path/to/config/file/elasticsearch.yml clean test
|
|
|
|
--------------------------------------------------
|