diff --git a/docs/modules/deploy/pages/deploying-with-docker.adoc b/docs/modules/deploy/pages/deploying-with-docker.adoc index fcdb68820..485540501 100644 --- a/docs/modules/deploy/pages/deploying-with-docker.adoc +++ b/docs/modules/deploy/pages/deploying-with-docker.adoc @@ -11,7 +11,7 @@ The default network mode in Docker is bridge. In this mode, all containers run i - Host network mode (Linux only) - Port mapping -WARNING: These methods open Hazelcast members to the public. Anybody who can reach the Docker host over the network can connect to Hazelcast ports of the running members. +include::deploy:partial$docker-ip-warning.adoc[] === Host Network Mode @@ -104,7 +104,7 @@ hazelcast: [source,bash,subs="attributes+"] ---- docker run --rm --name member1 \ - -e "JAVA_OPTS=-Dhazelcast.local.publicAddress=192.168.1.12" -p 5701:5701 hazelcast/hazelcast:{full-version} + -e HZ_NETWORK_PUBLICADDRESS=192.168.1.12:5701 -p 5701:5701 hazelcast/hazelcast:{full-version} ---- . Start another member on the second host. @@ -112,7 +112,7 @@ docker run --rm --name member1 \ [source,bash,subs="attributes+"] ---- docker run --rm --name member1 \ - -e "JAVA_OPTS=-Dhazelcast.local.publicAddress=192.168.1.13" -p 5701:5701 hazelcast/hazelcast:{full-version} + -e HZ_NETWORK_PUBLICADDRESS=192.168.1.13:5701 -p 5701:5701 hazelcast/hazelcast:{full-version} ---- In the member logs, you should see that your members connected to each other: diff --git a/docs/modules/deploy/partials/docker-ip-warning.adoc b/docs/modules/deploy/partials/docker-ip-warning.adoc new file mode 100644 index 000000000..53ddc9bb8 --- /dev/null +++ b/docs/modules/deploy/partials/docker-ip-warning.adoc @@ -0,0 +1 @@ +WARNING: These methods open Hazelcast members to the public. Anybody who can reach the Docker host over the network can connect to Hazelcast ports of the running members and perform actions - such as data manipulation or shutting down the members. \ No newline at end of file diff --git a/docs/modules/getting-started/pages/blue-green.adoc b/docs/modules/getting-started/pages/blue-green.adoc index 0db2f61bf..3269787a7 100644 --- a/docs/modules/getting-started/pages/blue-green.adoc +++ b/docs/modules/getting-started/pages/blue-green.adoc @@ -51,13 +51,15 @@ Run the following command on the terminal: docker run \ --network hazelcast-network \ --rm \ + -e HZ_NETWORK_PUBLICADDRESS=:5701 \ -e HZ_CLUSTERNAME=blue \ -e HZ_LICENSEKEY= \ <1> -p 5701:5701 hazelcast/hazelcast-enterprise:{full-version} ---- -<1> Replace the `` placeholder with your Hazelcast Enterprise license key. +<1> Replace the `` placeholder with the IP address of your Docker host. +<2> Replace the `` placeholder with your Hazelcast Enterprise license key. -You should see your cluster name in the console along with the IP address of the Docker container that's running the Hazelcast member. +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+"] ---- @@ -79,11 +81,13 @@ Start another local single-member cluster called `green`. docker run \ --network hazelcast-network \ --rm \ + -e HZ_NETWORK_PUBLICADDRESS=:5702 \ -e HZ_CLUSTERNAME=green \ -e HZ_LICENSEKEY= \ <1> -p 5702:5701 hazelcast/hazelcast-enterprise:{full-version} ---- -<1> Replace the `` placeholder with your Hazelcast Enterprise license key. +<1> Replace the `` placeholder with the IP address of your Docker host. +<2> Replace the `` placeholder with your Hazelcast Enterprise license key. See the `green` cluster is formed: @@ -246,7 +250,7 @@ XML:: <1> Number of times that the client will try to reconnect to each cluster before shutting down. + In this failover configuration file, you are directing the client to connect to the clusters in the given order from top to bottom; -see xref:clients:java#ordering-of-clusters-when-clients-try-to-connect[Ordering of Clusters]. So, when you start the client +see xref:clients:java#ordering-of-clusters-when-clients-try-to-connect.adoc[Ordering of Clusters]. So, when you start the client (see Step 4 below), it will initially connect to the `blue` cluster. Here is what may happen: * When the `blue` cluster fails, the client attempts to reconnect to it four times. @@ -384,5 +388,5 @@ move to the other tutorials. To shut down the cluster, close the terminals in wh If you're interested in learning more about the topics introduced in this tutorial, see: -* xref:clients:java#blue-green-deployment-and-disaster-recovery[Blue-Green Deployment]. +* xref:clients:java#blue-green-deployment-and-disaster-recovery.adoc[Blue-Green Deployment]. * xref:{page-latest-supported-mc}@management-center:clusters:client-filtering.adoc[Filtering Client Connections]. diff --git a/docs/modules/getting-started/pages/get-started-docker.adoc b/docs/modules/getting-started/pages/get-started-docker.adoc index e01aba2d2..921bd75ba 100644 --- a/docs/modules/getting-started/pages/get-started-docker.adoc +++ b/docs/modules/getting-started/pages/get-started-docker.adoc @@ -26,18 +26,24 @@ Docker networks make it easier for you to connect to your cluster and add other . To start a member, execute the Docker `run` command. + +include::deploy:partial$docker-ip-warning.adoc[] ++ +Replace the `` placeholder with the IP address of your Docker host. ++ [source,shell,subs="attributes+"] ---- docker run \ -it \ --network hazelcast-network \ --rm \ + -e HZ_NETWORK_PUBLICADDRESS=:5701 \ -e HZ_CLUSTERNAME=hello-world \ -p 5701:5701 hazelcast/hazelcast:{full-version} ---- + Hazelcast environment variables: + +- `HZ_NETWORK_PUBLICADDRESS`: The public IP address of your Docker host. - `HZ_CLUSTERNAME`: The name of your cluster. + Docker parameters: @@ -47,7 +53,7 @@ Docker parameters: - `--network`: Allows you to connect to clusters, using an alias. - `-p`: Expose port 5701 to allow external clients to connect to the member's Docker container. -You should see your cluster name in the console along with the IP address of the Docker container: +You should see your cluster name in the console along with the IP address of the Docker host: image:platform-cluster-name.png[Platform console displays the cluster name 'hello-world'] @@ -62,11 +68,11 @@ SQL:: -- . In a new terminal window, start the SQL shell. + -Replace the `$DOCKER_IP` placeholder with the IP address of your member's Docker container. +Replace the `` placeholder with the IP address of your Docker host. + [source,shell,subs="attributes+"] ---- -docker run --network hazelcast-network -it --rm hazelcast/hazelcast:{full-version} hz-cli --targets hello-world@$DOCKER_IP sql +docker run --network hazelcast-network -it --rm hazelcast/hazelcast:{full-version} hz-cli --targets hello-world@$ sql ---- + The `--targets` parameter tells the SQL shell to connect to the member at the given IP address in a cluster called `hello-world`. @@ -356,11 +362,11 @@ SQL:: -- . In a new terminal window, start the SQL shell. + -Replace the `$DOCKER_IP` placeholder with the IP address of your member's Docker container. +Replace the `` placeholder with the IP address of your Docker host. + [source,shell,subs="attributes+"] ---- -docker run --network hazelcast-network -it --rm hazelcast/hazelcast:{full-version} hz-cli --targets hello-world@$DOCKER_IP sql +docker run --network hazelcast-network -it --rm hazelcast/hazelcast:{full-version} hz-cli --targets hello-world@ sql ---- . Query all data in the map. @@ -644,22 +650,28 @@ In this step, you add two more members to your cluster. . Open a new terminal and execute the Docker `run` command again to start another member. + +Replace the `` placeholder with the IP address of your Docker host. ++ NOTE: Each container must expose port 5701 from a different port on the host machine. On this member, port 5701 is exposed to port 5702 on the host machine. + [source,shell,subs="attributes+"] ---- docker run \ --name my-second-member --network hazelcast-network \ + -e HZ_NETWORK_PUBLICADDRESS=:5702 \ -e HZ_CLUSTERNAME=hello-world \ -p 5702:5701 hazelcast/hazelcast:{full-version} ---- . Start another member. + +Replace the `` placeholder with the IP address of your Docker host. ++ [source,shell,subs="attributes+"] ---- docker run \ --name my-third-member --network hazelcast-network \ + -e HZ_NETWORK_PUBLICADDRESS=:5703 \ -e HZ_CLUSTERNAME=hello-world \ -p 5703:5701 hazelcast/hazelcast:{full-version} ---- @@ -721,4 +733,4 @@ Or, if you're interested in learning more about topics that we introduced in thi - xref:{page-latest-supported-mc}@management-center:getting-started:overview.adoc[Management Center] -- xref:network-partitioning:network-partitioning.adoc[Network partitioning] \ No newline at end of file +- xref:network-partitioning:network-partitioning.adoc[Network partitioning] diff --git a/docs/modules/getting-started/pages/persistence.adoc b/docs/modules/getting-started/pages/persistence.adoc index dba5c8fd9..29132e222 100644 --- a/docs/modules/getting-started/pages/persistence.adoc +++ b/docs/modules/getting-started/pages/persistence.adoc @@ -41,6 +41,7 @@ You'll start the first member in a cluster called `hello-world`. Run the followi docker run \ --name first-member --network hazelcast-network \ --rm \ + -e HZ_NETWORK_PUBLICADDRESS=:5701 \ -e HZ_CLUSTERNAME=hello-world \ -e HZ_LICENSEKEY= \ <1> -e HZ_PERSISTENCE_ENABLED=true \ <2> @@ -48,10 +49,11 @@ docker run \ -v ~/persist:/opt/hazelcast/persistence \ <4> -p 5701:5701 hazelcast/hazelcast-enterprise:{full-version} ---- -<1> Replace the `` placeholder with your Hazelcast Enterprise license key. -<2> The environment variable to enable the persistence feature for the member -<3> The environment variable to enable the persistence feature for a map -<4> By default, the persistence feature creates the `/opt/hazelcast/persistence` directory to store the persisted data. +<1> Replace the `` placeholder with the IP address of your Docker host. +<2> Replace the `` placeholder with your Hazelcast Enterprise license key. +<3> The environment variable to enable the persistence feature for the member +<4> The environment variable to enable the persistence feature for a map +<5> By default, the persistence feature creates the `/opt/hazelcast/persistence` directory to store the persisted data. However, using a Docker image, you cannot create any files inside the container. This line of the command mounts a directory on your local to the container, which in this case is `persist` under the home directory. This way, the container will use this local directory to save the persisted data. @@ -71,7 +73,11 @@ Your first member is started now, you can see from its terminal logs that persis == Step 2. Start More Members -Run each of the following Docker commands in a separate terminal. Replace the `` placeholders with your Hazelcast Enterprise license key. +Run each of the following Docker commands in a separate terminal. + +Replace the `` placeholders with the IP address of your Docker host. + +Replace the `` placeholders with your Hazelcast Enterprise license key. .Command to start a second member. [source,shell,subs="attributes+"] @@ -79,6 +85,7 @@ Run each of the following Docker commands in a separate terminal. Replace the `< docker run \ --name second-member --network hazelcast-network \ --rm \ + -e HZ_NETWORK_PUBLICADDRESS=:5702 \ -e HZ_CLUSTERNAME=hello-world \ -e HZ_LICENSEKEY= \ -e HZ_PERSISTENCE_ENABLED=true \ @@ -94,6 +101,7 @@ docker run \ docker run \ --name third-member --network hazelcast-network \ --rm \ + -e HZ_NETWORK_PUBLICADDRESS=:5703 \ -e HZ_CLUSTERNAME=hello-world \ -e HZ_LICENSEKEY= \ -e HZ_PERSISTENCE_ENABLED=true \ diff --git a/docs/modules/getting-started/pages/wan.adoc b/docs/modules/getting-started/pages/wan.adoc index bf5dfe2d0..3d730a2d1 100644 --- a/docs/modules/getting-started/pages/wan.adoc +++ b/docs/modules/getting-started/pages/wan.adoc @@ -43,11 +43,13 @@ which means it does not need WAN Replication to be configured. Run the following ---- docker run \ --network hazelcast-network \ + -e HZ_NETWORK_PUBLICADDRESS=:5701 \ -e HZ_LICENSEKEY= \ <1> -e HZ_CLUSTERNAME=london \ hazelcast/hazelcast-enterprise:{full-version} ---- -<1> Replace the `` placeholder with your Hazelcast Enterprise license key. +<1> Replace the `` placeholder with the IP address of your Docker host. +<2> Replace the `` placeholder with your Hazelcast Enterprise license key. The member is up and running now. @@ -60,9 +62,6 @@ Members {size:1, ver:1} [ ] ---- -Note the member's IP address and port since you are going to use it to configure WAN -Replication for the active cluster and to connect to Management Center. - == Step 2. Start the Active Cluster Now you'll start another Enterprise cluster called `tokyo` with a single member. This will be the **active** cluster @@ -89,7 +88,7 @@ hazelcast: batch-publisher: londonPublisherId: cluster-name: london - target-endpoints: 172.18.0.3:5701 + target-endpoints: :5701 map: cities: <1> wan-replication-ref: @@ -111,7 +110,7 @@ XML:: london londonPublisherId - 172.18.0.3:5701 + "host_ip":5701