Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ This step also installs your {enterprise-product-name} license key.
----
docker run \
--rm \
-e HZ_NETWORK_PUBLICADDRESS=localhost:5701 \ <1>
-e HZ_NETWORK_PUBLICADDRESS=localhost:5701 \# <1>
-e HZ_CLUSTERNAME=blue \
-e HZ_LICENSEKEY=<YOUR_LICENSE_KEY> \ <2>
-e HZ_LICENSEKEY=<YOUR_LICENSE_KEY> \# <2>
-p 5701:5701 hazelcast/hazelcast-enterprise:{ee-version}
----
<1> You can replace `host.docker.internal` with a specific IP address if you prefer but make sure you adjust the following code examples accordingly.
<1> You can replace `host.docker.internal` with a specific IP address if you prefer but make sure you adjust the following code examples accordingly.
<2> Replace the `<YOUR_LICENSE_KEY>` placeholder with your Hazelcast {enterprise-product-name} license key.

You should see your cluster name in the console along with the IP address of the Docker host that's running the Hazelcast member.

[source,shell,subs="attributes+"]
----
2024-12-01 18:26:42,369 [ INFO] [main] [c.h.i.c.ClusterService]: [localhost]:5701 [blue] [{ee-version}]
2024-12-01 18:26:42,369 [ INFO] [main] [c.h.i.c.ClusterService]: [localhost]:5701 [blue] [{ee-version}]

Members {size:1, ver:1} [
Member [localhost]:5701 - c00213e1-da50-4b5f-a53b-ccfe4a1ebeea this
Expand All @@ -72,7 +72,7 @@ docker run \
--rm \
-e HZ_NETWORK_PUBLICADDRESS=localhost:5702 \
-e HZ_CLUSTERNAME=green \
-e HZ_LICENSEKEY=<YOUR_LICENSE_KEY> \ <1>
-e HZ_LICENSEKEY=<YOUR_LICENSE_KEY> \# <1>
-p 5702:5701 hazelcast/hazelcast-enterprise:{ee-version}
----
<1> Replace the `<YOUR_LICENSE_KEY>` placeholder with your Hazelcast {enterprise-product-name} license key.
Expand All @@ -81,7 +81,7 @@ You should see the `green` cluster is formed, with confirmation that looks like:

[source,shell,subs="attributes+"]
----
2021-12-01 18:28:46,299 [ INFO] [main] [c.h.i.c.ClusterService]: [localhost]:5701 [green] [{ee-version}]
2021-12-01 18:28:46,299 [ INFO] [main] [c.h.i.c.ClusterService]: [localhost]:5701 [green] [{ee-version}]

Members {size:1, ver:1} [
Member [localhost]:5701 - 72f5520c-8c27-4501-9199-a8da6b58c0b4 this
Expand Down Expand Up @@ -113,11 +113,11 @@ To do this, you need to create two client configurations for the same client, an
----
. Create the client configuration file for the `blue` cluster, called `client-blue.yaml` (or `client-blue.xml`) and save it in the `resources` directory:
+
[tabs]
====
YAML::
+
--
[tabs]
====
YAML::
+
--
.client-blue.yaml
[source,yaml]
----
Expand Down Expand Up @@ -156,11 +156,11 @@ XML::
. Create the client configuration for the `green` cluster, called `client-green.yaml` (or `client-green.xml`)
and save it in the `resources` directory:
+
[tabs]
====
YAML::
+
--
[tabs]
====
YAML::
+
--
.client-green.yaml
[source,yaml]
----
Expand Down Expand Up @@ -197,11 +197,11 @@ XML::
====

+
[tabs]
====
YAML::
+
--
[tabs]
====
YAML::
+
--
.hazelcast-client-failover.yaml
[source,yaml]
----
Expand Down Expand Up @@ -241,15 +241,15 @@ In this step, you'll start the client.

NOTE: This step provides the code for the next step for Java client and the full code example for Node.js; for other clients, you can adapt the code accordingly.

[tabs]
====
Java::
[tabs]
====
Java::
+

. Install the xref:getting-started:install-hazelcast.adoc#use-java[Java client library].
. Add the following to the `MyClient.java` file:
+
--
--
[source,java,subs="attributes+"]
----
import com.hazelcast.client.HazelcastClient;
Expand Down Expand Up @@ -300,7 +300,7 @@ const { Client } = require('hazelcast-client');
clusterConnectTimeoutMillis: 1000
}
}
},
},
{
clusterName: 'green',
network: {
Expand All @@ -314,7 +314,7 @@ const { Client } = require('hazelcast-client');
}
]
});

} catch (err) {
console.error('Error occurred:', err);
}
Expand Down Expand Up @@ -357,7 +357,7 @@ Dec 01, 2024 8:16:45 PM com.hazelcast.core.LifecycleService
INFO: hz.client_1 [green] [{ee-version}] HazelcastClient {ee-version} (20210922 - dbaeffe) is CLIENT_CONNECTED
----

NOTE: In this type of failover scenario, the client does not automatically reconnect to the `blue` cluster when it is back online. Instead, you need to deploy a deny list using xref:{page-latest-supported-mc}@management-center:clusters:client-filtering.adoc[client filtering] to block client connections to the `green` cluster. The client will then use the failover configuration (in <<step-3, Step 3>>) to reconnect to the original cluster. When the client is reconnected, you can remove the client filter.
NOTE: In this type of failover scenario, the client does not automatically reconnect to the `blue` cluster when it is back online. Instead, you need to deploy a deny list using xref:{page-latest-supported-mc}@management-center:clusters:client-filtering.adoc[client filtering] to block client connections to the `green` cluster. The client will then use the failover configuration (in <<step-3, Step 3>>) to reconnect to the original cluster. When the client is reconnected, you can remove the client filter.

== Step 6: Clean up

Expand All @@ -373,7 +373,7 @@ In this tutorial, you learned how to:

== Next steps

If you're interested in learning more about the topics introduced in this tutorial, see:
If you're interested in learning more about the topics introduced in this tutorial, see:

* xref:clients:java.adoc#blue-green-deployment-and-disaster-recovery[]
* xref:{page-latest-supported-mc}@management-center:clusters:client-filtering.adoc[]
Expand Down