apache-ignite

Форк
0
/
discovery-in-the-cloud.adoc 
312 строк · 10.3 Кб
1
// Licensed to the Apache Software Foundation (ASF) under one or more
2
// contributor license agreements.  See the NOTICE file distributed with
3
// this work for additional information regarding copyright ownership.
4
// The ASF licenses this file to You under the Apache License, Version 2.0
5
// (the "License"); you may not use this file except in compliance with
6
// the License.  You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
= Discovery in the Cloud
16

17
:javaFile: {javaCodeDir}/DiscoveryInTheCloud.java
18

19
Nodes discovery on a cloud platform is usually proven to be more
20
challenging because most virtual environments are subject to the
21
following limitations:
22

23
* Multicast is disabled;
24
* TCP addresses change every time a new image is started.
25

26
Although you can use TCP-based discovery in the absence of the
27
Multicast, you still have to deal with constantly changing IP addresses.
28
This causes a serious inconvenience and makes configurations based on
29
static IPs virtually unusable in such environments.
30

31
To mitigate the constantly changing IP addresses problem, Ignite supports a number of IP finders designed to work in the cloud:
32

33
* Apache jclouds IP Finder
34
* Amazon S3 IP Finder
35
* Amazon ELB IP Finder
36
* Google Cloud Storage IP Finder
37
* Azure Blob Storage IP Finder
38

39

40
TIP: Cloud-based IP Finders allow you to create your configuration once and reuse it for all instances.
41

42
== Apache jclouds IP Finder
43

44
To mitigate the constantly changing IP addresses problem, Ignite supports automatic node discovery by utilizing Apache jclouds multi-cloud toolkit via `TcpDiscoveryCloudIpFinder`.
45
For information about Apache jclouds please refer to https://jclouds.apache.org[jclouds.apache.org].
46

47
The IP finder forms nodes addresses by getting the private and public IP addresses of all virtual machines running on the cloud and adding a port number to them.
48
The port is the one that is set with either `TcpDiscoverySpi.setLocalPort(int)` or `TcpDiscoverySpi.DFLT_PORT`.
49
This way all the nodes can try to connect to any formed IP address and initiate automatic grid node discovery.
50

51
Refer to https://jclouds.apache.org/reference/providers/#compute[Apache jclouds providers section] to get the list of supported cloud platforms.
52

53
CAUTION: All virtual machines must start Ignite instances on the same port, otherwise they will not be able to discover each other using this IP finder.
54

55
Here is an example of how to configure Apache jclouds based IP finder:
56

57

58
[tabs]
59
--
60
tab:XML[]
61
[source,xml]
62
----
63
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
64
  <property name="discoverySpi">
65
    <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
66
      <property name="ipFinder">
67
        <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder">
68
            <!-- Configuration for Google Compute Engine. -->
69
            <property name="provider" value="google-compute-engine"/>
70
            <property name="identity" value="YOUR_SERVICE_ACCOUNT_EMAIL"/>
71
            <property name="credentialPath" value="PATH_YOUR_PEM_FILE"/>
72
            <property name="zones">
73
            <list>
74
                <value>us-central1-a</value>
75
                <value>asia-east1-a</value>
76
            </list>
77
            </property>
78
        </bean>
79
      </property>
80
    </bean>
81
  </property>
82
</bean>
83
----
84

85
tab:Java[]
86
[source,java]
87
----
88
include::{javaFile}[tag=jclouds,indent=0]
89
----
90
tab:C#/.NET[unsupported]
91
tab:C++[unsupported]
92
--
93

94

95
== Amazon S3 IP Finder
96

97
Amazon S3-based discovery allows Ignite nodes to register their IP addresses on start-up in an Amazon S3 store.
98
This way other nodes can try to connect to any of the IP addresses stored in S3 and initiate automatic node discovery.
99
To use S3 based automatic node discovery, you need to configure the `TcpDiscoveryS3IpFinder` type of `ipFinder`.
100

101
IMPORTANT: You must download and link:setup#enabling-modules[enable the 'ignite-aws-ext' extension].
102

103
Here is an example of how to configure Amazon S3 based IP finder:
104

105

106
[tabs]
107
--
108
tab:XML[]
109
[source,xml]
110
----
111
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
112

113
  <property name="discoverySpi">
114
    <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
115
      <property name="ipFinder">
116
        <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder">
117
          <property name="awsCredentials" ref="aws.creds"/>
118
          <property name="bucketName" value="YOUR_BUCKET_NAME"/>
119
        </bean>
120
      </property>
121
    </bean>
122
  </property>
123
</bean>
124

125
<!-- AWS credentials. Provide your access key ID and secret access key. -->
126
<bean id="aws.creds" class="com.amazonaws.auth.BasicAWSCredentials">
127
  <constructor-arg value="YOUR_ACCESS_KEY_ID" />
128
  <constructor-arg value="YOUR_SECRET_ACCESS_KEY" />
129
</bean>
130
----
131

132
tab:Java[]
133
[source,java]
134
----
135
include::{javaFile}[tag=aws1,indent=0]
136
----
137

138
tab:C#/.NET[unsupported]
139
tab:C++[unsupported]
140
--
141

142
You can also use *Instance Profile* for AWS credentials provider.
143

144
[tabs]
145
--
146
tab:XML[]
147
[source,xml]
148
----
149
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
150

151
  <property name="discoverySpi">
152
    <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
153
      <property name="ipFinder">
154
        <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder">
155
          <property name="awsCredentialsProvider" ref="aws.creds"/>
156
          <property name="bucketName" value="YOUR_BUCKET_NAME"/>
157
        </bean>
158
      </property>
159
    </bean>
160
  </property>
161
</bean>
162

163
<!-- Instance Profile based credentials -->
164
<bean id="aws.creds" class="com.amazonaws.auth.InstanceProfileCredentialsProvider">
165
  <constructor-arg value="false" />
166
</bean>
167
----
168

169
tab:Java[]
170
[source,java]
171
----
172
include::{javaFile}[tag=aws2,indent=0]
173
----
174
tab:C#/.NET[unsupported]
175
tab:C++[unsupported]
176
--
177

178

179
== Amazon ELB Based Discovery
180

181
AWS ELB-based IP finder does not require nodes to register their IP
182
addresses. The IP finder automatically fetches addresses of all the
183
nodes connected under an ELB and uses them to connect to the cluster. To
184
use ELB based automatic node discovery, you need to configure the
185
`TcpDiscoveryElbIpFinder` type of `ipFinder`.
186

187
Here is an example of how to configure Amazon ELB based IP finder:
188

189

190
[tabs]
191
--
192
tab:XML[]
193
[source,xml]
194
----
195
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
196

197
  <property name="discoverySpi">
198
    <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
199
      <property name="ipFinder">
200
        <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.elb.TcpDiscoveryElbIpFinder">
201
          <property name="credentialsProvider">
202
              <bean class="com.amazonaws.auth.AWSStaticCredentialsProvider">
203
                  <constructor-arg ref="aws.creds"/>
204
              </bean>
205
          </property>
206
          <property name="region" value="YOUR_ELB_REGION_NAME"/>
207
          <property name="loadBalancerName" value="YOUR_AWS_ELB_NAME"/>
208
        </bean>
209
      </property>
210
    </bean>
211
  </property>
212
</bean>
213

214
<!-- AWS credentials. Provide your access key ID and secret access key. -->
215
<bean id="aws.creds" class="com.amazonaws.auth.BasicAWSCredentials">
216
  <constructor-arg value="YOUR_ACCESS_KEY_ID" />
217
  <constructor-arg value="YOUR_SECRET_ACCESS_KEY" />
218
</bean>
219
----
220

221
tab:Java[]
222
[source,java]
223
----
224
include::{javaFile}[tag=awsElb,indent=0]
225
----
226

227
tab:C#/.NET[unsupported]
228
tab:C++[unsupported]
229
--
230

231

232
== Google Compute Discovery
233

234
Ignite supports automatic node discovery by utilizing Google Cloud Storage store.
235
This mechanism is implemented in `TcpDiscoveryGoogleStorageIpFinder`.
236
On start-up, each node registers its IP address in the storage and discovers other nodes by reading the storage.
237

238
IMPORTANT: To use `TcpDiscoveryGoogleStorageIpFinder`, enable the `ignite-gce` link:setup#enabling-modules[module] in your application.
239

240
Here is an example of how to configure Google Cloud Storage based IP finder:
241

242
[tabs]
243
--
244
tab:XML[]
245
[source,xml]
246
----
247
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
248

249
  <property name="discoverySpi">
250
    <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
251
      <property name="ipFinder">
252
        <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder">
253
          <property name="projectName" value="YOUR_GOOGLE_PLATFORM_PROJECT_NAME"/>
254
          <property name="bucketName" value="YOUR_BUCKET_NAME"/>
255
          <property name="serviceAccountId" value="YOUR_SERVICE_ACCOUNT_ID"/>
256
          <property name="serviceAccountP12FilePath" value="PATH_TO_YOUR_PKCS12_KEY"/>
257
        </bean>
258
      </property>
259
    </bean>
260
  </property>
261
</bean>
262
----
263

264
tab:Java[]
265
[source,java]
266
----
267
include::{javaFile}[tag=google,indent=0]
268
----
269
tab:C#/.NET[unsupported]
270
tab:C++[unsupported]
271
--
272

273
== Azure Blob Storage
274

275
Ignite supports automatic node discovery by utilizing Azure Blob Storage.
276
This mechanism is implemented in `TcpDiscoveryAzureBlobStorageIpFinder`.
277
On start-up, each node registers its IP address in the storage and discovers other nodes by reading the storage.
278

279
IMPORTANT: To use `TcpDiscoveryAzureBlobStorageIpFinder` you must download and link:setup#enabling-modules[enable the 'ignite-azure-ext' extension].
280

281
Here is an example of how to configure Azure Blob Storage based IP finder:
282

283
[tabs]
284
--
285
tab:XML[]
286
[source,xml]
287
----
288
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
289

290
  <property name="discoverySpi">
291
    <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
292
      <property name="ipFinder">
293
        <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.azure.TcpDiscoveryAzureBlobStoreIpFinder">
294
          <property name="accountName" value="YOUR_AZURE_BLOB_STORAGE_ACCOUNT_NAME"/>
295
          <property name="accountKey" value="YOUR_AZURE_BLOB_STORAGE_ACCOUNT_KEY"/>
296
          <property name="accountEndpoint" value="YOUR_END_POINT"/>
297
          <property name="containerName" value="YOUR_CONTAINER_NAME"/>
298
        </bean>
299
      </property>
300
    </bean>
301
  </property>
302
</bean>
303
----
304

305
tab:Java[]
306
[source,java]
307
----
308
include::{javaFile}[tag=azureBlobStorage,indent=0]
309
----
310
tab:C#/.NET[unsupported]
311
tab:C++[unsupported]
312
--
313

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.