-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhazelcast-etcd-discovery-spi-example.xml
149 lines (109 loc) · 8.88 KB
/
hazelcast-etcd-discovery-spi-example.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast id="hazelcast-etcd-discovery"
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.6.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>hazelcast-etcd-discovery-spi</name>
<password>haz3lcast1</password>
</group>
<properties>
<property name="hazelcast.discovery.enabled">true</property>
<property name="hazelcast.shutdownhook.enabled">false</property>
</properties>
<network>
<port auto-increment="true">5701</port>
<join>
<multicast enabled="false"/>
<aws enabled="false"/>
<tcp-ip enabled="false" />
<!-- Enable a Etcd based discovery strategy -->
<discovery-strategies>
<discovery-strategy enabled="true"
class="org.bitsofinfo.hazelcast.discovery.etcd.EtcdDiscoveryStrategy">
<properties>
<!--
Comma separated list of URIs for etcd hosts to connect to
(one or more required) FORMAT: http[s]://[ip | hostname]:[port],...
All must be HTTPS or HTTP (NOT intermixed)
-->
<property name="etcd-uris">http://localhost:4001</property>
<!--
The root hazelcast cluster name "/key" by which all nodes
entries exist under in the form /[etcd-service-name]/[hz-instance-id]
= value { ip:xx.xx.xx.xx, hostname:my.host, port: xx, ...}
-->
<property name="etcd-service-name">hz-discovery-test-cluster</property>
<!--
An optional username to connect to etcd.
<property name="etcd-username">root</property>
-->
<!--
An optional password for the above username if one is setup for etcd.
<property name="etcd-password">password</property>
-->
<!--
If you quickly start an entire hz cluster at the exact same time, and
all hazelcast nodes are registered with Etcd at the same time, its
possible they may all discover ONLY themselves as members, leading to a cluster
that can never be fully discovered. This small delay can assist with avoiding
that problem. @see https://github.com/hazelcast/hazelcast/issues/6813
-->
<property name="etcd-discovery-delay-ms">10000</property>
<!--
Optional properties in order to provide certs and keys for secure communication. You can configure trusted root certs
that are needed for communication with etcd, when it is configured to have secure communication enabled.
You can also provide a client cert and a private key through 'etcd-client-cert-location' and 'etcd-client-key-location' in case
your etcd has client-authentication activated and asks for a client cert.
In case your root certs and client cert are chained in one file it is ok to define this file in 'etcd-client-cert-location' and
omit the trusted cert property. The implementation will extract the first cert as your client cert and the rest as trusted certs.
Certificates should be X509 and provided in PEM encoded file.
Keys can be provided as PKCS#8 or PKCS#1 in a PEM encoded file.
<property name="etcd-client-cert-location">/path/to/tls.crt</property>
<property name="etcd-client-key-location">/path/to/tls.key</property>
<property name="etcd-trusted-cert-location">/path/to/trusted.crt</property>
-->
<!--
EtcdRegistrator:
This (optionally) enables the DiscoveryStrategy to register this hazelcast instance with Etcd
directly and deregister it on shutdown.
LocalDiscoveryNodeRegistrator: Uses the private/public IP:PORT determined by this Hazelcast instance
(and tags above) as the identifiers for registering itself with Etcd
as a unique node.
ExplicitIpPortRegistrator: Uses an explicit IP:PORT specified by you in the 'etcd-registrator-config' below
(and tags above) as the identifiers for registering itself with Etcd
as a unique node.
DoNothingRegistrator: Does NOTHING in regards to registration or deregistration of this node as a service
with Etcd. This should be used if you are registering your nodes with Etcd yourself and
managing the registration of this Hazelcast node manually. In the format:
/[etcd-service-name]/[hz-instance-id] = { ip:xx.xx.xx.xx, hostname:my.host, port: xx, ...}
Note: hz-instance-id can be anything, but needs to be unique...
-->
<property name="etcd-registrator">org.bitsofinfo.hazelcast.discovery.etcd.LocalDiscoveryNodeRegistrator</property>
<!-- Custom properties for the EtcdRegistrator class you are using, JSON. @see EtcdRegistrator implementation
class for details on the configuration unique to it.
The configuration below is for LocalDiscoveryNodeRegistrator:
- preferPublicAddress (true|false) : use the public IP determined by
hazelcast (if not null) over the private IP
-->
<property name="etcd-registrator-config"><![CDATA[
{
"preferPublicAddress":false
}
]]></property>
<!-- The configuration below is for ExplicitIpPortRegistrator:
- registerWithIpAddress: register with this IP in Etcd
- registerWithPort: register with this PORT in Etcd
<property name="etcd-registrator-config"><![CDATA[
{
"registerWithIpAddress":"192.168.0.208",
"registerWithPort":5701
}
]]></property>
-->
</properties>
</discovery-strategy>
</discovery-strategies>
</join>
</network>
</hazelcast>