Setup Hazelcast Management Center docker to use a port other than 8080

431 views
Skip to first unread message

star...@gmail.com

unread,
Dec 13, 2019, 9:24:24 AM12/13/19
to Hazelcast
I have another docker using port 8080, so to setup Hazelcast and Hazelcast Management Center with another port (for e.g. 8000) I used the following commands

docker run -d -e MANCENTER_URL="http://localhost:8000/hazelcast-mancenter" hazelcast/hazelcast:latest
docker run -d -e MC_HTTP_PORT=8000 -p 8000:8000 hazelcast/management-center:latest

But when I open http://localhost:8000/hazelcast-mancenter in browser, it says "Not connected"

Mesut Celik

unread,
Dec 13, 2019, 2:15:21 PM12/13/19
to haze...@googlegroups.com
Hi,

You need to use host networking when you launch hazelcast docker container by using --net host

docker run --net host -d -e MANCENTER_URL="http://localhost:8000/hazelcast-mancenter" hazelcast/hazelcast:latest

docker run -d -e MC_HTTP_PORT=8000 -p 8000:8000 hazelcast/management-center:latest

The reason to use host networking is because localhost will not work in default docker networking, hence localhost can't be resolved. You need to know MC IP address.

This is how you can setup the same environment without host networking.
docker run -d -e MC_HTTP_PORT=8000 -p 8000:8000 --name management-center hazelcast/management-center:latest
MANCENTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' management-center)
docker run -d -e MANCENTER_URL="http://${MANCENTER_IP}:8000/hazelcast-mancenter" hazelcast/hazelcast:latest

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/9ac3ad01-a00b-4c85-b0d6-1574f82c3c06%40googlegroups.com.


--

Mesut Celik
Services & Integration Team Lead 
me...@hazelcast.com 
hazelcast-logo-email.png

star...@gmail.com

unread,
Dec 14, 2019, 6:44:35 AM12/14/19
to Hazelcast
Thanks for the valuable tip.

I used 
docker inspect <MC CONTAINED ID> | grep "IPAddress"
to obtain the MC IP address. And then used that IP Address in the command
docker run -d -e MANCENTER_URL="http://<MC IPAddress>:8000/hazelcast-mancenter" hazelcast/hazelcast:latest

Now in browser with http://localhost:8000/hazelcast-mancenter, it says connected to dev.

But I am facing with a different problem now. My client is not able to connect to Hazelcast.
I tried 
telnet <MACHINE IP> 5701  
and it was not able to connect.

If I run docker images it shows
hazelcast/management-center                  latest              7e1b53e25d83        3 weeks ago         264MB
hazelcast/hazelcast                                   latest              4d84b8c9103d        5 weeks ago         116MB


How do I troubleshoot?



On Saturday, December 14, 2019 at 12:45:21 AM UTC+5:30, Mesut Celik wrote:
Hi,

You need to use host networking when you launch hazelcast docker container by using --net host

docker run --net host -d -e MANCENTER_URL="http://localhost:8000/hazelcast-mancenter" hazelcast/hazelcast:latest
docker run -d -e MC_HTTP_PORT=8000 -p 8000:8000 hazelcast/management-center:latest

The reason to use host networking is because localhost will not work in default docker networking, hence localhost can't be resolved. You need to know MC IP address.

This is how you can setup the same environment without host networking.
docker run -d -e MC_HTTP_PORT=8000 -p 8000:8000 --name management-center hazelcast/management-center:latest
MANCENTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' management-center)
docker run -d -e MANCENTER_URL="http://${MANCENTER_IP}:8000/hazelcast-mancenter" hazelcast/hazelcast:latest

On Fri, Dec 13, 2019 at 9:24 AM <star...@gmail.com> wrote:
I have another docker using port 8080, so to setup Hazelcast and Hazelcast Management Center with another port (for e.g. 8000) I used the following commands

docker run -d -e MANCENTER_URL="http://localhost:8000/hazelcast-mancenter" hazelcast/hazelcast:latest
docker run -d -e MC_HTTP_PORT=8000 -p 8000:8000 hazelcast/management-center:latest

But when I open http://localhost:8000/hazelcast-mancenter in browser, it says "Not connected"

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haze...@googlegroups.com.

Mesut Celik

unread,
Dec 14, 2019, 1:56:26 PM12/14/19
to haze...@googlegroups.com
if you bind 5701 to a local port when starting hazelcast then you should be able to connect via hazelcast client.

docker run -d -e MANCENTER_URL="http://${MANCENTER_IP}:8000/hazelcast-mancenter" -p 5701:5701 hazelcast/hazelcast:latest

if you want one more member then you need to increment local port
docker run -d -e MANCENTER_URL="http://${MANCENTER_IP}:8000/hazelcast-mancenter" -p 5702:5701 hazelcast/hazelcast:latest

One important note is that if you have 2 and more members inside your cluster and want to connect from your local, you need to disable smartRouting.
// start Hazelcast Client with smartRouting disabled
ClientConfig cfg = new ClientConfig();
cfg.getNetworkConfig().setSmartRouting(false);
HazelcastInstance client = HazelcastClient.newHazelcastClient(cfg);

To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/d9895c37-e25e-4b9e-9485-dd66c3fc6104%40googlegroups.com.
hazelcast-logo-email.png

star...@gmail.com

unread,
Dec 15, 2019, 3:49:48 AM12/15/19
to Hazelcast
Oops :( Totally overlooked port binding in the mancenter command. Thanks for pointing that out. 

One last thing. I want to enable multiple simultaneous logins, so I guess following is the right command

docker run -d -e MC_HTTP_PORT=8000 -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true' -p 8000:8000 hazelcast/management-center:latest

Now, I already have the container created and running without the -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'
I do not want to create another container using the run command again with the additional -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'
Is there a way I could use the docker start command with the additional -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'

Mesut Celik

unread,
Dec 15, 2019, 1:06:17 PM12/15/19
to haze...@googlegroups.com
You can kill or remove existing container and restart the new one with -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'
https://docs.docker.com/engine/reference/commandline/rm/

To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/d2a4b2ee-56d4-4473-870e-58d91f21f44c%40googlegroups.com.
hazelcast-logo-email.png

Sumit

unread,
Dec 15, 2019, 1:43:55 PM12/15/19
to haze...@googlegroups.com
So you are saying that there is no way to reuse the existing container with the -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'?

You received this message because you are subscribed to a topic in the Google Groups "Hazelcast" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hazelcast/iKI_dhABY9M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/CAAUiUJc1_PscaV3icjpoYCv6rBqB8RS1yEoOSx9WHazJo_RMUQ%40mail.gmail.com.

Emre Aydın

unread,
Dec 16, 2019, 2:39:49 AM12/16/19
to haze...@googlegroups.com
Hi Sumit,

The parameter cannot be changed during runtime, so you’ll need to restart the container with the correct parameter.

Regards,
Emre

--




Emre Aydın
Management Center Team Lead
em...@hazelcast.com

On 15 Dec 2019, at 21:43, Sumit <star...@gmail.com> wrote:

So you are saying that there is no way to reuse the existing container with the -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'?

On Sun, Dec 15, 2019 at 11:36 PM Mesut Celik <me...@hazelcast.com> wrote:
You can kill or remove existing container and restart the new one with -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'
https://docs.docker.com/engine/reference/commandline/rm/

On Sun, Dec 15, 2019 at 3:49 AM <star...@gmail.com> wrote:
Oops :( Totally overlooked port binding in the mancenter command. Thanks for pointing that out. 

One last thing. I want to enable multiple simultaneous logins, so I guess following is the right command
docker run -d -e MC_HTTP_PORT=8000 -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true' -p 8000:8000 hazelcast/management-center:latest

Now, I already have the container created and running without the -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'
I do not want to create another container using the run command again with the additional -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'
Is there a way I could use the docker start command with the additional -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true'


On Sunday, December 15, 2019 at 12:26:26 AM UTC+5:30, Mesut Celik wrote:
if you bind 5701 to a local port when starting hazelcast then you should be able to connect via hazelcast client.

docker run -d -e MANCENTER_URL="http://${MANCENTER_IP}:8000/hazelcast-mancenter" -p 5701:5701hazelcast/hazelcast:latest

if you want one more member then you need to increment local port
docker run -d -e MANCENTER_URL="http://${MANCENTER_IP}:8000/hazelcast-mancenter" -p 5702:5701hazelcast/hazelcast:latest

star...@gmail.com

unread,
Dec 16, 2019, 3:29:49 AM12/16/19
to Hazelcast
Hi Emre,

I am ok with restarting the container (i.e. docker stop followed by docker start). I am not ok with creating a new one (i.e. docker run). I am hoping that I could use something like 
docker start -e JAVA_OPTS='-Dhazelcast.mc.allowMultipleLogin=true' <CONTAINER ID>

Thanks,
Sumit


-- 

Mesut Celik
Services & Integration Team Lead 
me...@hazelcast.com 

-- 
You received this message because you are subscribed to a topic in the Google Groups "Hazelcast" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hazelcast/iKI_dhABY9M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to haze...@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haze...@googlegroups.com.

Emre Aydın

unread,
Dec 16, 2019, 3:30:37 AM12/16/19
to haze...@googlegroups.com
That should work. 


--




Emre Aydın
Management Center Team Lead
em...@hazelcast.com
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/81b1ea66-232b-421c-83d8-18fc668b52fb%40googlegroups.com.

star...@gmail.com

unread,
Jan 20, 2020, 1:50:19 AM1/20/20
to Hazelcast
Unfortunately, "docker start" command does not have "-e" option.
To unsubscribe from this group and stop receiving emails from it, send an email to haze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/81b1ea66-232b-421c-83d8-18fc668b52fb%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages