@@ -52,14 +52,19 @@ How to start (long story)
52
52
Before starting, you should have :
53
53
54
54
* 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/ )
56
56
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
+ ` ` `
57
62
58
63
# ## Creating your first instance
59
64
60
65
61
66
` ` ` sh
62
- gcutil --project=es-cloud addinstance myesnode1 \
67
+ gcutil addinstance myesnode1 \
63
68
--service_account_scope=compute-rw,storage-full \
64
69
--persistent_boot_disk
65
70
` ` `
@@ -73,7 +78,7 @@ Then, choose your zone. Let's say here that we choose `europe-west1-a`.
73
78
74
79
Choose your compute instance size. Let's say `f1-micro`.
75
80
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 `.
77
82
78
83
You may be asked to create a ssh key. Follow instructions to create one.
79
84
@@ -89,9 +94,13 @@ Table of resources:
89
94
+-----------+--------------+-------+---------+--------------+----------------+----------------+----------------+---------+----------------+
90
95
` ` `
91
96
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 :
93
98
94
99
` ` `
100
+ # Connect using google cloud SDK
101
+ gcloud compute ssh myesnode1 --zone europe-west1-a
102
+
103
+ # Or using SSH with external IP address
95
104
ssh -i ~/.ssh/google_compute_engine 192.158.29.199
96
105
` ` `
97
106
@@ -100,38 +109,14 @@ Once connected, install Elasticsearch:
100
109
` ` ` sh
101
110
sudo apt-get update
102
111
103
- # Install curl if needed
104
- sudo apt-get install curl
105
-
106
112
# 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
108
114
109
115
# Prepare Java installation
110
116
sudo apt-get install java7-runtime-headless
111
117
112
118
# 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
135
120
` ` `
136
121
137
122
# ## Install elasticsearch cloud gce plugin
@@ -140,7 +125,7 @@ Install the plugin:
140
125
141
126
` ` ` sh
142
127
# 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
144
129
145
130
# Configure it:
146
131
sudo vi /etc/elasticsearch/elasticsearch.yml
@@ -149,19 +134,19 @@ sudo vi /etc/elasticsearch/elasticsearch.yml
149
134
And add the following lines :
150
135
151
136
` ` ` 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
158
143
` ` `
159
144
160
145
161
- Restart elasticsearch :
146
+ Start elasticsearch :
162
147
163
148
` ` ` sh
164
- sudo /etc/init.d/elasticsearch restart
149
+ sudo /etc/init.d/elasticsearch start
165
150
` ` `
166
151
167
152
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
188
173
189
174
` ` ` sh
190
175
# 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/
193
177
194
178
# An image has been created in ` /tmp` directory:
195
179
ls /tmp
196
180
e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz
197
181
198
182
# 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
-
202
183
# Create a bucket to hold your image, let's say `esimage`:
203
184
gsutil mb gs://esimage
204
185
205
186
# Copy your image to this bucket:
206
187
gsutil cp /tmp/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz gs://esimage
207
188
208
189
# 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
220
191
221
192
# If the previous command did not work for you, logout from your instance
222
193
# 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:
228
199
229
200
``` sh
230
201
# 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 \
232
206
--kernel=projects/google/global/kernels/gce-v20130603 myesnode2 \
233
207
--zone europe-west1-a --machine_type f1-micro --service_account_scope=compute-rw \
234
208
--persistent_boot_disk
@@ -240,11 +214,11 @@ You can use [Google Cloud Console](https://cloud.google.com/console) or CLI to m
240
214
241
215
``` sh
242
216
# Stopping and removing instances
243
- gcutil --project=es-cloud deleteinstance myesnode1 myesnode2 \
217
+ gcutil deleteinstance myesnode1 myesnode2 \
244
218
--zone=europe-west1-a
245
219
246
220
# 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 \
248
222
--zone=europe-west1-a
249
223
```
250
224
@@ -273,14 +247,14 @@ gcutil --project=es-cloud addinstance myesnode1 \
273
247
Then, define it in ` elasticsearch.yml ` :
274
248
275
249
``` yaml
276
- cloud :
250
+ cloud :
251
+ gce :
252
+ project_id : es-cloud
253
+ zone : europe-west1-a
254
+ discovery :
255
+ type : gce
277
256
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
284
258
` ` `
285
259
286
260
Changing default transport port
@@ -295,13 +269,13 @@ Add `--metadata=es_port:9301` option:
295
269
296
270
` ` ` sh
297
271
# when creating first instance
298
- gcutil --project=es-cloud addinstance myesnode1 \
272
+ gcutil addinstance myesnode1 \
299
273
--service_account_scope=compute-rw,storage-full \
300
274
--persistent_boot_disk \
301
275
--metadata=es_port:9301
302
276
303
277
# 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 \
305
279
--kernel=projects/google/global/kernels/gce-v20130603 myesnode2 \
306
280
--zone europe-west1-a --machine_type f1-micro --service_account_scope=compute-rw \
307
281
--persistent_boot_disk --metadata=es_port:9301
@@ -311,8 +285,7 @@ gcutil --project=es-cloud addinstance --image=elasticsearch-1-0-0-RC1 \
311
285
312
286
` ` ` sh
313
287
# Get metadata fingerprint
314
- gcutil --project=es-cloud getinstance myesnode1 \
315
- --zone=europe-west1-a
288
+ gcutil getinstance myesnode1 --zone=europe-west1-a
316
289
+------------------------+---------------------------------------------------------------------------------------------------------+
317
290
| property | value |
318
291
+------------------------+---------------------------------------------------------------------------------------------------------+
@@ -321,7 +294,7 @@ gcutil --project=es-cloud getinstance myesnode1 \
321
294
+------------------------+---------------------------------------------------------------------------------------------------------+
322
295
323
296
# Use that fingerprint
324
- gcutil --project=es-cloud setinstancemetadata myesnode1 \
297
+ gcutil setinstancemetadata myesnode1 \
325
298
--zone=europe-west1-a \
326
299
--metadata=es_port:9301 \
327
300
--fingerprint=42WmSpB8rSM=
0 commit comments