You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+87-31Lines changed: 87 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,15 @@
1
1
# hazelcast-consul-discovery-spi
2
2
3
-
Provides a Consul based discovery strategy for Hazlecast 3.6-EA+ enabled applications.
3
+
Provides a Consul based discovery strategy for Hazlecast 3.6-RC1+ enabled applications.
4
4
This is an easy to configure plug-and-play Hazlecast DiscoveryStrategy that will optionally register each of your Hazelcast instances with Consul and enable Hazelcast nodes to dynamically discover one another via Consul.
5
5
6
6
*[Status](#status)
7
+
*[Releases](#releases)
7
8
*[Requirements](#requirements)
9
+
*[Maven/Gradle install](#mavengradle)
8
10
*[Features](#features)
9
-
*[Build/Usage](#usage)
11
+
*[Usage](#usage)
12
+
*[Build from source](#building)
10
13
*[Unit tests](#tests)
11
14
*[Related Info](#related)
12
15
*[Todo](#todo)
@@ -17,14 +20,68 @@ This is an easy to configure plug-and-play Hazlecast DiscoveryStrategy that will
17
20
18
21
## <aid="status"></a>Status
19
22
20
-
This is beta code.
23
+
This is beta code, tested against Hazelcast 3.6-EA and 3.6-RC1
24
+
25
+
## <aid="releases"></a>Releases
26
+
27
+
*[1.0-RC1](https://github.com/bitsofinfo/hazelcast-consul-discovery-spi/releases/tag/1.0-RC1): Tested against Hazelcast 3.6-EA and 3.6-RC1
21
28
22
29
## <aid="requirements"></a>Requirements
23
30
24
31
* Java 6+
25
-
*[Hazelcast 3.6-EA+](https://hazelcast.org/)
32
+
*[Hazelcast 3.6-RC1+](https://hazelcast.org/)
26
33
*[Consul](https://consul.io/)
27
34
35
+
## <aid="mavengradle"></a>Maven/Gradle
36
+
37
+
To use this discovery strategy in your Maven or Gradle project use the dependency samples below.
(for the https://github.com/OrbitzWorldwide/consul-client dependency)
69
+
implementation - see gradle example above
70
+
-->
71
+
</dependencies>
72
+
73
+
<repositories>
74
+
<repository>
75
+
<snapshots>
76
+
<enabled>false</enabled>
77
+
</snapshots>
78
+
<id>central</id>
79
+
<name>bintray</name>
80
+
<url>http://jcenter.bintray.com</url>
81
+
</repository>
82
+
</repositories>
83
+
```
84
+
28
85
## <aid="features"></a>Features
29
86
30
87
@@ -40,24 +97,16 @@ This is beta code.
40
97
* Control which IP is published as the service-address with Consul
41
98
* Configurable discovery delay
42
99
* Automatic Consul de-registration of instance via ShutdownHook
100
+
101
+
102
+
## <aid="usage"></a>Usage
43
103
44
-
## <aid="usage"></a>Build & Usage
104
+
* Ensure your project has the `hazelcast-consul-discovery-spi` artifact dependency declared in your maven pom or gradle build file as described above. Or build the jar yourself and ensure the jar is in your project's classpath.
45
105
46
106
* Have Consul running and available somewhere on your network, start it such as:
* From the root of this project, build a Jar : `./gradlew assemble`
51
-
52
-
* Include the built jar artifact located at `build/libs/hazelcast-consul-discovery-spi-1.0.0.jar` in your hazelcast project
53
-
54
-
* If not already present in your hazelcast application's Maven (pom.xml) or Gradle (build.gradle) dependencies section; ensure that these dependencies are present (versions may vary as appropriate):
* Configure your hazelcast.xml configuration file to use the `ConsulDiscoveryStrategy` (similar to the below): [See hazelcast-consul-discovery-spi-example.xml](src/main/resources/hazelcast-consul-discovery-spi-example.xml) for a full example with documentation of options.
* From the root of this project, build a Jar : `./gradlew assemble`
194
+
195
+
* Include the built jar artifact located at `build/libs/hazelcast-consul-discovery-spi-[VERSION].jar` in your hazelcast project
196
+
197
+
* If not already present in your hazelcast application's Maven (pom.xml) or Gradle (build.gradle) dependencies section; ensure that these dependencies are present (versions may vary as appropriate):
***Etcd** version of this: https://github.com/bitsofinfo/hazelcast-etcd-discovery-spi
159
222
160
223
## <aid="todo"></a>Todo
161
224
162
225
* Ensure all configuration tweakable via `-D` system properties
163
-
* Add support to force registered IP and PORT (for certain containerized scenarios)
164
226
165
227
## <aid="notes"></a> Notes
166
228
@@ -171,7 +233,7 @@ that would need to automatically register themselves with Consul for higher leve
171
233
172
234
If you are deploying your Hazelcast application as a Docker container, one helpful tip is that you will want to avoid hardwired
173
235
configuration in the hazelcast XML config, but rather have your Docker container take startup arguments that would be translated
174
-
to `-D` system properties on startup. Convienently Hazelcast can consume these JVM system properties and replace variable placeholders in the XML config. See this documentation for examples: [http://docs.hazelcast.org/docs/3.6-EA/manual/html-single/index.html#using-variables](http://docs.hazelcast.org/docs/3.6-EA/manual/html-single/index.html#using-variables)
236
+
to `-D` system properties on startup. Convienently Hazelcast can consume these JVM system properties and replace variable placeholders in the XML config. See this documentation for examples: [http://docs.hazelcast.org/docs/3.6-RC1/manual/html-single/index.html#using-variables](http://docs.hazelcast.org/docs/3.6-RC1/manual/html-single/index.html#using-variables)
175
237
176
238
Specifically when using this discovery strategy and Docker, it may be useful for you to use the [ExplicitIpPortRegistrator](src/main/java/org/bitsofinfo/hazelcast/discovery/consul/ExplicitIpPortRegistrator.java)`ConsulRegistrator`**instead** of the *LocalDiscoveryNodeRegistrator* as the latter relies on hazelcast to determine its IP/PORT and this may end up being the local container IP, and not the Docker host IP, leading to a situation where a unreachable IP/PORT combination is published to Consul.
177
239
@@ -195,12 +257,6 @@ See this [Docker issue for related info](https://github.com/docker/docker/issues
195
257
]]></property>
196
258
```
197
259
198
-
### Prior hazelcast versions
199
-
For versions of Hazelcast **prior to 3.6** you may want to look at these projects which seem to provide older implementations of Consul based discovery:
You should see this in your Consul agent monitor when the health-check scripts are running:
@@ -214,11 +270,11 @@ You should see this in your Consul agent monitor when the health-check scripts a
214
270
You will see something like these warnings logged when the health-check script interrogates the hazelcast port and does nothing. You are free to monitor the services any way you wish, or not at all by omitting the `healthCheckScript` JSON property; see [See hazelcast-consul-discovery-spi-example.xml](src/main/resources/hazelcast-consul-discovery-spi-example.xml) for an example.
215
271
```
216
272
Nov 20, 2015 6:57:50 PM com.hazelcast.nio.tcp.SocketAcceptorThread
217
-
INFO: [192.168.0.208]:5701 [hazelcast-consul-discovery] [3.6-EA] Accepting socket connection from /192.168.0.208:53495
273
+
INFO: [192.168.0.208]:5701 [hazelcast-consul-discovery] [3.6-RC1] Accepting socket connection from /192.168.0.208:53495
218
274
Nov 20, 2015 6:57:50 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
219
-
INFO: [192.168.0.208]:5701 [hazelcast-consul-discovery] [3.6-EA] Established socket connection between /192.168.0.208:5701 and /192.168.0.208:53495
275
+
INFO: [192.168.0.208]:5701 [hazelcast-consul-discovery] [3.6-RC1] Established socket connection between /192.168.0.208:5701 and /192.168.0.208:53495
220
276
Nov 20, 2015 6:57:50 PM com.hazelcast.nio.tcp.nonblocking.NonBlockingSocketWriter
221
-
WARNING: [192.168.0.208]:5701 [hazelcast-consul-discovery] [3.6-EA] SocketWriter is not set, creating SocketWriter with CLUSTER protocol!
277
+
WARNING: [192.168.0.208]:5701 [hazelcast-consul-discovery] [3.6-RC1] SocketWriter is not set, creating SocketWriter with CLUSTER protocol!
222
278
Nov 20, 2015 6:57:50 PM com.hazelcast.nio.tcp.TcpIpConnection
0 commit comments