bitsofinfo / hazelcast-docker-swarm-discovery-spi

Docker Swarm based discovery strategy SPI for Hazelcast enabled applications
Apache License 2.0
39 stars 33 forks source link

NumberFormatException at SwarmMemberAddressProvider line 58 #29

Closed robinroos closed 5 years ago

robinroos commented 5 years ago

Hello,

I finally have a proxy defined and am starting to deploy SwarmMemberAddressPicker.

I get a NumberFormatException at SwarmMemberAddressProvider:58 because I do not provide an environment property corresponding to "hazelcastPeerPort".

The reason I do not provide this property is that this service actually embeds TWO Hazelcast cache nodes, each on different ports (5701 and 5702). The peer port is provided explicitly in the two different hazelcast XML files used to bootstrap the two cache nodes in this one app, e.g.

<property name="hazelcast-peer-port">5701</property> and separately <property name="hazelcast-peer-port">5702</property>

Would it be possible to have a really quick release to jcenter making that environment property truly optional?

Much obliged, Robin. NFE_SwarmMemberAddressProvider.txt

robinroos commented 5 years ago

Perhaps the underlying issue here is that the code execution path has gone into the SwarmMemberAddressProvider() constructor, instead of reading properties from XML and going instead to the (String, String, String, Integer) constructor.

bitsofinfo commented 5 years ago

Try RC11 and see updated README and updated https://github.com/bitsofinfo/hazelcast-docker-swarm-discovery-spi/blob/master/src/main/resources/hazelcast-docker-swarm-discovery-spi-example-member-address-provider.xml

You can now define those props in the HZ config's <member-address-provider> stanza so it should all be scoped by each of your HZ configs to instances. So you would just just change the port number per diff HZ config file.

See: https://docs.hazelcast.org/docs/3.9.4/manual/html-single/index.html#member-address-provider-spi

robinroos commented 5 years ago

Wow, you guys are quick.

I've just been debugging Hazelcast to establish that SwarmMemberAddressProvider would benefit from a (Properties) constructor, with properties relocated into the member-address-provider element, and you have the prospective fix here for me already!

Will test now....

robinroos commented 5 years ago

Looks really good so far. I've stepped through as far as I can go and the properties are being correctly passed into the SwarmMemberAddressProvider's new constructor and are being correctly extracted prior to being passed to initialize().

I will deploy this into Docker Swarm in the morning and let you know how I get on.

In the mean-time, one documentation correction for: https://github.com/bitsofinfo/hazelcast-docker-swarm-discovery-spi/blob/master/src/main/resources/hazelcast-docker-swarm-discovery-spi-example-member-address-provider.xml The optional property elements within member-address-provider need to be within a properties element.

robinroos commented 5 years ago

A few other notes from our on-going deployment efforts. I'm putting these here now so that I don't forget them later:

skipVerifySsl MUST be set false if the swarmMgrUri is http://. Inadvertently setting this true causes SMAP to seek the certificates, even though https is not being used.

The docker-socket-proxy must expose the /version endpoint, in addition to the documented requirement to expose /tasks /networks /services.

robinroos commented 5 years ago

Thanks for this! RC11 does address this issue, as long as property elements are relocated as discussed.

Please note the documentation suggestions above.