Trying Hazelcast - change port

215 views
Skip to first unread message

Marisca

unread,
Jul 28, 2016, 10:17:12 PM7/28/16
to Hazelcast
hello everyone

last time i can run hazelcast in two server, and its synchronized, thanks for all your help :D

but now i want to ask how to change port,
i know that hazelcast can run 100 port, and it can be configured how many port do you want to use, and it can also set the port that you want to start
when i try it 

<network> <port>5801</port> </network>

 in my pom.xml and  when i run it, terminated.

i cant find hazelcast.xml
in my program i dont use hazelcast.xml but i still can run the program, but the problem maybe i cant configure it

so i want to ask
how can i find hazelcast.xml ? if i find it, where i must put it ? 

Thank you

Vassilis Bekiaris

unread,
Jul 29, 2016, 2:18:17 AM7/29/16
to Hazelcast
Hi Marisca,

Hazelcast can be configured either declaratively or programmatically. In the declarative style you specify your Hazelcast configuration in an XML file, then either explicitly tell hazelcast the location from which to load the configuration file or if your XML config is an a file called "hazelcast.xml" and in the root of your classpath then it will be picked up automatically. So, to summarize, if your project is a maven project with the standard directory structure, create a new file called hazelcast.xml under YOUR_PROJECT_FOLDER/src/main/resources and include this content:

<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.6.xsd"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <network>
    <port auto-increment="true" port-count="10">5801</port>
  </network>
</hazelcast>

The above XML configuration references Hazelcast 3.6 configuration schema (hazelcast-config-3.6.xsd). The port configuration specifies that Hazelcast will attempt to use port 5801 for opening its server socket. If this socket is already used, then auto-increment="true" specifies that hazelcast will add one to the port number and try again until a free port is located. Finally, port-count="10" specifies that Hazelcast will attempt to locate a free port in 5801 - 5811 range; if none is found then startup will fail.

Configuration is discussed in several places in the manual, you may want to start here: http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#understanding-configuration

Cheers!
Vassilis

Noctarius

unread,
Jul 29, 2016, 2:38:38 AM7/29/16
to Christoph Engelbert - Hazelcast
Hey Marisca,

Please see the corresponding sections in the documentation:

Chris


--
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 post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/0eab8527-f841-4c07-8881-350b68baf90d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marisca

unread,
Jul 29, 2016, 3:08:06 AM7/29/16
to Hazelcast
oh i see, thank you very much sir ^^b

Marisca

unread,
Jul 29, 2016, 3:08:41 AM7/29/16
to Hazelcast
thank you sir, i'll try to understand it 
Reply all
Reply to author
Forward
0 new messages