Skip to content

Commit 37474b4

Browse files
committed
Update instructions for GCE
Some tools have changed on GCE platform. We need to update the documentation. Closes #23.
1 parent b1e27bb commit 37474b4

File tree

1 file changed

+43
-70
lines changed

1 file changed

+43
-70
lines changed

README.md

+43-70
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,19 @@ How to start (long story)
5252
Before starting, you should have:
5353

5454
* Your project ID. Let's say here `es-cloud`. Get it from [Google APIS Console](https://code.google.com/apis/console/).
55-
* [GCUtil](https://developers.google.com/compute/docs/gcutil/#install)
55+
* [Google Cloud SDK](https://developers.google.com/cloud/sdk/)
5656

57+
If you did not set it yet, you can define your default project you will work on:
58+
59+
```sh
60+
gcloud config set project es-cloud
61+
```
5762

5863
### Creating your first instance
5964

6065

6166
```sh
62-
gcutil --project=es-cloud addinstance myesnode1 \
67+
gcutil addinstance myesnode1 \
6368
--service_account_scope=compute-rw,storage-full \
6469
--persistent_boot_disk
6570
```
@@ -73,7 +78,7 @@ Then, choose your zone. Let's say here that we choose `europe-west1-a`.
7378

7479
Choose your compute instance size. Let's say `f1-micro`.
7580

76-
Choose your OS. Let's say `projects/debian-cloud/global/images/debian-7-wheezy-v20130617`.
81+
Choose your OS. Let's say `projects/debian-cloud/global/images/debian-7-wheezy-v20140606`.
7782

7883
You may be asked to create a ssh key. Follow instructions to create one.
7984

@@ -89,9 +94,13 @@ Table of resources:
8994
+-----------+--------------+-------+---------+--------------+----------------+----------------+----------------+---------+----------------+
9095
```
9196

92-
You can now connect to your machine using the external IP address in order to install Elasticsearch:
97+
You can now connect to your instance:
9398

9499
```
100+
# Connect using google cloud SDK
101+
gcloud compute ssh myesnode1 --zone europe-west1-a
102+
103+
# Or using SSH with external IP address
95104
ssh -i ~/.ssh/google_compute_engine 192.158.29.199
96105
```
97106

@@ -100,38 +109,14 @@ Once connected, install Elasticsearch:
100109
```sh
101110
sudo apt-get update
102111
103-
# Install curl if needed
104-
sudo apt-get install curl
105-
106112
# Download Elasticsearch
107-
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.0.RC1.deb
113+
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.1.deb
108114
109115
# Prepare Java installation
110116
sudo apt-get install java7-runtime-headless
111117
112118
# Prepare Elasticsearch installation
113-
sudo dpkg -i elasticsearch-1.0.0.RC1.deb
114-
115-
# Check that elasticsearch is running:
116-
curl http://localhost:9200/
117-
```
118-
119-
This command should give you a JSON result:
120-
121-
```javascript
122-
{
123-
"ok" : true,
124-
"status" : 200,
125-
"name" : "Shriker",
126-
"version" : {
127-
"number" : "1.0.0.RC1",
128-
"build_hash" : "0a5781f44876e8d1c30b6360628d59cb2a7a2bbb",
129-
"build_timestamp" : "2014-01-10T10:18:37Z",
130-
"build_snapshot" : false,
131-
"lucene_version" : "4.6"
132-
},
133-
"tagline" : "You Know, for Search"
134-
}
119+
sudo dpkg -i elasticsearch-1.2.1.deb
135120
```
136121

137122
### Install elasticsearch cloud gce plugin
@@ -140,7 +125,7 @@ Install the plugin:
140125

141126
```sh
142127
# Use Plugin Manager to install it
143-
sudo /usr/share/elasticsearch/bin/plugin --install elasticsearch/elasticsearch-cloud-gce/2.0.0.RC1
128+
sudo /usr/share/elasticsearch/bin/plugin --install elasticsearch/elasticsearch-cloud-gce/2.2.0
144129
145130
# Configure it:
146131
sudo vi /etc/elasticsearch/elasticsearch.yml
@@ -149,19 +134,19 @@ sudo vi /etc/elasticsearch/elasticsearch.yml
149134
And add the following lines:
150135

151136
```yaml
152-
cloud:
153-
gce:
154-
project_id: es-cloud
155-
zone: europe-west1-a
156-
discovery:
157-
type: gce
137+
cloud:
138+
gce:
139+
project_id: es-cloud
140+
zone: europe-west1-a
141+
discovery:
142+
type: gce
158143
```
159144

160145

161-
Restart elasticsearch:
146+
Start elasticsearch:
162147

163148
```sh
164-
sudo /etc/init.d/elasticsearch restart
149+
sudo /etc/init.d/elasticsearch start
165150
```
166151

167152
If anything goes wrong, you should check logs:
@@ -188,35 +173,21 @@ First create an image of your running instance and upload it to Google Cloud Sto
188173

189174
```sh
190175
# Create an image of yur current instance
191-
sudo python /usr/share/imagebundle/image_bundle.py \
192-
-r / -o /tmp/ --log_file=/tmp/abc.log
176+
sudo /usr/bin/gcimagebundle -d /dev/sda -o /tmp/
193177
194178
# An image has been created in `/tmp` directory:
195179
ls /tmp
196180
e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz
197181

198182
# Upload your image to Google Cloud Storage:
199-
# Launch this command and follow instructions to give your instance an access to your storage
200-
gsutil config
201-
202183
# Create a bucket to hold your image, let's say `esimage`:
203184
gsutil mb gs://esimage
204185

205186
# Copy your image to this bucket:
206187
gsutil cp /tmp/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz gs://esimage
207188

208189
# Then add your image to images collection:
209-
gcutil listkernels --project es-cloud
210-
+----------------------------------------------+--------------------------------------------------+-------------+
211-
| name | description | deprecation |
212-
+----------------------------------------------+--------------------------------------------------+-------------+
213-
| projects/google/global/kernels/gce-20120621 | 2.6.39-gcg built 2012-03-29 01:07:00 | DEPRECATED |
214-
| projects/google/global/kernels/gce-v20130603 | SCSI-enabled 3.3.8-gcg built 2013-05-29 01:04:00 | |
215-
+----------------------------------------------+--------------------------------------------------+-------------+
216-
# Note the kernel you prefer to use and add your image to your catalog:
217-
gcutil --project=es-cloud addimage elasticsearch-1-0-0-RC1 \
218-
gs://esimage/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz \
219-
--preferred_kernel=projects/google/global/kernels/gce-v20130603
190+
gcutil addimage elasticsearch-1-2-1 gs://esimage/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz
220191

221192
# If the previous command did not work for you, logout from your instance
222193
# and launch the same command from your local machine.
@@ -228,7 +199,10 @@ As you have now an image, you can create as many instances as you need:
228199

229200
```sh
230201
# Just change node name (here myesnode2)
231-
gcutil --project=es-cloud addinstance --image=elasticsearch-1-0-0-RC1 \
202+
gcutil addinstance --image=elasticsearch-1-2-1 myesnode2
203+
204+
# If you want to provide all details directly, you can use:
205+
gcutil addinstance --image=elasticsearch-1-2-1 \
232206
--kernel=projects/google/global/kernels/gce-v20130603 myesnode2 \
233207
--zone europe-west1-a --machine_type f1-micro --service_account_scope=compute-rw \
234208
--persistent_boot_disk
@@ -240,11 +214,11 @@ You can use [Google Cloud Console](https://cloud.google.com/console) or CLI to m
240214

241215
```sh
242216
# Stopping and removing instances
243-
gcutil --project=es-cloud deleteinstance myesnode1 myesnode2 \
217+
gcutil deleteinstance myesnode1 myesnode2 \
244218
--zone=europe-west1-a
245219

246220
# Consider removing disk as well if you don't need them anymore
247-
gcutil --project=es-cloud deletedisk boot-myesnode1 boot-myesnode2 \
221+
gcutil deletedisk boot-myesnode1 boot-myesnode2 \
248222
--zone=europe-west1-a
249223
```
250224

@@ -273,14 +247,14 @@ gcutil --project=es-cloud addinstance myesnode1 \
273247
Then, define it in `elasticsearch.yml`:
274248

275249
```yaml
276-
cloud:
250+
cloud:
251+
gce:
252+
project_id: es-cloud
253+
zone: europe-west1-a
254+
discovery:
255+
type: gce
277256
gce:
278-
project_id: es-cloud
279-
zone: europe-west1-a
280-
discovery:
281-
type: gce
282-
gce:
283-
tags: elasticsearch, dev
257+
tags: elasticsearch, dev
284258
```
285259
286260
Changing default transport port
@@ -295,13 +269,13 @@ Add `--metadata=es_port:9301` option:
295269

296270
```sh
297271
# when creating first instance
298-
gcutil --project=es-cloud addinstance myesnode1 \
272+
gcutil addinstance myesnode1 \
299273
--service_account_scope=compute-rw,storage-full \
300274
--persistent_boot_disk \
301275
--metadata=es_port:9301
302276
303277
# when creating an instance from an image
304-
gcutil --project=es-cloud addinstance --image=elasticsearch-1-0-0-RC1 \
278+
gcutil addinstance --image=elasticsearch-1-0-0-RC1 \
305279
--kernel=projects/google/global/kernels/gce-v20130603 myesnode2 \
306280
--zone europe-west1-a --machine_type f1-micro --service_account_scope=compute-rw \
307281
--persistent_boot_disk --metadata=es_port:9301
@@ -311,8 +285,7 @@ gcutil --project=es-cloud addinstance --image=elasticsearch-1-0-0-RC1 \
311285

312286
```sh
313287
# Get metadata fingerprint
314-
gcutil --project=es-cloud getinstance myesnode1 \
315-
--zone=europe-west1-a
288+
gcutil getinstance myesnode1 --zone=europe-west1-a
316289
+------------------------+---------------------------------------------------------------------------------------------------------+
317290
| property | value |
318291
+------------------------+---------------------------------------------------------------------------------------------------------+
@@ -321,7 +294,7 @@ gcutil --project=es-cloud getinstance myesnode1 \
321294
+------------------------+---------------------------------------------------------------------------------------------------------+
322295
323296
# Use that fingerprint
324-
gcutil --project=es-cloud setinstancemetadata myesnode1 \
297+
gcutil setinstancemetadata myesnode1 \
325298
--zone=europe-west1-a \
326299
--metadata=es_port:9301 \
327300
--fingerprint=42WmSpB8rSM=

0 commit comments

Comments
 (0)