I have a multi-service deployment where some of the services use Hazelcast for caching. On actual deployments, where is service resides in a separate VM, the hazelcast instance starts on port 5701. However, when doing tests locally, all services reside on the same VM. This means that the first Hazelcast instance starts on 5701, the second on 5702 and so on (auto-increment is set to true in the configuration).
The problem is that the hazelcast client tries to connect to the 5701 to 5703 and does not search any further.
To make sure I don't have any overlap in the ports (so no auto-incrementation is done) I manually configured the ports for the Hazelcast Instance. So, for one of the services I set it to 5710. However, the client tries to connect from 5701.
I've read that network->port is not available for Hazelcast Client config, but I could not find how to specify the port to try to connect?
I am using Hazelcast 3.6
Config file:
<group>
<name>myNode</name>
<password>MyPass</password>
</group>
<properties>
<property name="hazelcast.rest.enabled">true</property>
<property name="hazelcast.shutdownhook.enabled">false</property>
</properties>
<management-center enabled="false"/>
<network>
<port auto-increment="true">5701</port>
<join>
<multicast enabled="true"/>
<tcp-ip enabled="false"/>
<aws enabled="false"/>
</join>
</network>
The solution was to add the cluster configuration to the client-configuration xml:
<network>
<cluster-members>
<address>127.0.0.1:57xx</address>
</cluster-members>
</network>
You just pass the address (ip:port) to the connection configuration of the client. Anyhow I wonder what you do to start so many independent cluster members (different clusters?) on a single machine.
For hazelcast 4 and up you can use the following
ClientConfig
config.getNetworkConfig()
.addAddress(HazelcastProperties.getAddress())
.setRedoOperation(true)
.setSmartRouting(true);
config.setClusterName(HazelcastProperties.getGroupName());
config.setInstanceName(HazelcastProperties.getInstanceName());
String address = HazelcastProperties.getAddress();
if (address.contains(":"))
{
String port = address.substring(address.indexOf(":" + 1));
config.getNetworkConfig()
.addOutboundPort(Integer.parseInt(port));
}
else
{
config.getNetworkConfig()
.addOutboundPort(5701);
}
Reference : https://docs.hazelcast.org/docs/4.0/manual/html-single/index.html#port
Related
After updating my ServiceFabric cluster to version 6.5, a warning has started popping up for my applications.
Endpoint MyEndpoint with ExplicitPort 27000 is within application port range. This can cause port conflicts. Please select a port from outside application port range.
Why is this error happening and what do I need to do to fix it?
Starting with ServiceFabric 6.5CU2, ServiceFabric started to show warnings for these misconfigurations. These warnings might turn into errors in the future.
By design static ports should not overlap with application port range specified in the ClusterManifest. If you specify a static port, assign it outside of application port range, otherwise it will result in port conflicts. With release 6.5CU2 we will issue a Health Warning when we detect such a conflict but let the deployment continue in sync with the shipped 6.5 behaviour. However, we may prevent the application deployment from the next major releases.
(https://learn.microsoft.com/en-gb/azure/service-fabric/service-fabric-service-manifest-resources)
The application port range is cluster wide and is 20000-30000 by default.
You can change it e.g. via ARM template or https://resources.azure.com
"nodeTypes": [
{
"name": "nt",
...
"applicationPorts": {
"startPort": 20000,
"endPort": 30000
},
...
}
],
The static endpoint port can be configured in the servicemanifest.json of your service.
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest ...>
<Resources>
<Endpoints>
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="MyEndpoint" Protocol="http" Port="27000" PathSuffix="/xxx" UriScheme="http" Type="Input" />
</Endpoints>
</Resources>
</ServiceManifest>
I have reverse proxy properly configured on both local and deployed cluster but Iam unable to access my owin based webAPI on reverse proxy port here is the response I get on this port
I have followed this link and am sure that its configured properly. The question is do I need to change some thing in my project or code to make it work.
Here is my service manifest for the webAPI :
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="BimWebApiPkg"
Version="1.0.9"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ServiceTypes>
<!-- This is the name of your ServiceType.
This name must match the string used in RegisterServiceType call in Program.cs. -->
<StatelessServiceType ServiceTypeName="BimWebApiType" />
</ServiceTypes>
<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="1.0.9">
<EntryPoint>
<ExeHost>
<Program>BimWebApi.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>
<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
independently-updateable and versioned set of custom configuration settings for your service. -->
<ConfigPackage Name="Config" Version="1.0.9" />
<Resources>
<Endpoints>
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="80" />
</Endpoints>
</Resources>
</ServiceManifest>
I also tried without specifying any port but that too didn't work.
Seems like the url is incorrect. It's missing the part where you should have app name and service name specified. Try this -
http://localhost:19081/YOUR_APP_NAME/BimWebApi/api/TestAPI/GetString/
I am trying to implement a connection between my application (Spring integration) with IBM-MQ, I did see the question spring-integration-support-for-clustered-high-availability-ibm-mq-manager, but in my case each host has different "queueManager" and "channels", it means I will have must have a configuration like follows but, the queueManager and channels properties support a String not a list values:
<bean id="connectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="connectionNameList" value="host1(6464),host1(6464)" />
<property name="clientReconnectTimeout" value="15000" />
<property name="transportType" value="1" />
<property name="queueManager" value="QM1, QM1," />
<property name="channel" value="channel1,channel1"/>
</bean>
The simplest thing would be to define a channel with the same name on both hosts and let the client try host1 first and then host2 using connectionNameList. In this setup it would always prefer host1. You would need to specify a queueManager that is blank so that the client will accept the queue manager it connects to. Example follows:
<property name="queueManager" value="" />
Another option that was pointed out in a comment from Morag on the other post you linked to is to use a CCDT (Client channel definition table).
See Using a client channel definition table with IBM WebSphere MQ classes for JMS. The property name is CCDTURL
The CCDT can have multiple CLNTCONN channel entries with different channel names all having the same QMNAME, this is called a Queue Manager Group, you would then specify the queueManager property as *QMNAME, this will allow the app to connect to which ever queue manager you are directed to with out regard to the actual queue manager name. There are other parameters of the CLNTCONN listed at the bottom of the link I provided that can help you to control if one queue manager is preferred over the other(s) as well as which queue manager to connect to if a reconnect is required.
The context
Two nodes of a Hazelcast cluster, each on a discrete subnet so multicast is not suitable nor working for node location.
I should like to employ the most minimal XML configuration file, say hazelcast.xml, to configure Hazelcast to use TCP/IP to connect the two nodes. Ideally a directory of the IP addresses of the two nodes.
The question
The Hazelcast docs do a good job of showing how this can be achieved programatically, and how hazelcast.jar/hazelcast-default.xml holds the (considerable) default configuration.
What is unclear is: is any XML configuration I supply overlaid upon the settings within hazelcast-default.xml - or simply used in its stead?
I have both my answers, and should like to share them
Just like the programatic API, the XML configuration overlays the defaults found in hazelcast.jar/hazelcast-default.xml, consequently ...
I can establish a very simple two-member cluster with this hazelcast.xml in the classpath
<hazelcast>
<network>
<join>
<multicast enabled="false"></multicast>
<tcp-ip enabled="true">
<member>192.168.100.001</member> <!-- server A -->
<member>192.168.102.200</member> <!-- server B, on separate subnet -->
</tcp-ip>
</join>
</network>
</hazelcast>
I'm not familiar with hazelcast.conf files.
Mostly used is XML or Programmatic api. For good examples see:
https://github.com/hazelcast/hazelcast-code-samples/tree/master/network-configuration
Example of programmatic:
public class Main {
public static void main(String[] args){
Config config = new Config();
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember("localhost").setEnabled(true);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
}
}
--
What is unclear is: is any XML configuration I supply overlaid upon the settings within hazelcast-default.xml - or simply used in its stead?
What do you mean? If you use the programmatic API, the rest is not relevant. If you don't provide an explicit Config object while constructing the HazelcastInstance, a defaulting mechanism is used. And eventually it defaults to hazelcast-default.xml.
I have 02 nodes, one runs on 127.0.0.1 and another runs on 127.0.0.2
Will data that I add to my cluster will appear both on two nodes? As current, when I stop node 1, there is no similar data in the second node, it also throws some exceptions when I use list command:
Using default limit of 100
Using default column limit of 100
null
UnavailableException()
at org.apache.cassandra.thrift.Cassandra$get_range_slices_result.read(Cassandra.java:12346)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_get_range_slices(Cassandra.java:692)
at org.apache.cassandra.thrift.Cassandra$Client.get_range_slices(Cassandra.java:676)
at org.apache.cassandra.cli.CliClient.executeList(CliClient.java:1425)
at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:273)
at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:219)
at org.apache.cassandra.cli.CliMain.main(CliMain.java:346)
One more thing is I use kundera to connect to cassandra db in my java application (Built on Play FW 2.0.4), my persistence file is as below:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="cassandra_pu">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<properties>
<property name="kundera.nodes" value="localhost"/>
<property name="kundera.port" value="9160"/>
<property name="kundera.keyspace" value="LSYCS"/>
<property name="kundera.dialect" value="cassandra"/>
<property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
<property name="kundera.cache.provider.class" value="com.impetus.kundera.cache.ehcache.EhCacheProvider"/>
<property name="kundera.cache.config.resource" value="/ehcache-test.xml"/>
</properties>
</persistence-unit>
</persistence>
I assumed that when node 1 is down, the application will still able to connect to second node, but it wasnot able to do that. Is something really really wrong here ? What I expects is when 127.0.0.1 is offline, 127.0.0.2 will able to handle the jobs, or do they need a top application to manage them?
P/S: I setup on my computer thus both 127.0.0.1 and 127.0.0.2 point to localhost
Did you change replication_factor (default is 1) for cassandra connections.
Have a look at:
https://github.com/impetus-opensource/Kundera/wiki/Cassandra-Specific-Features
For configuring cassandra settings within kundera.
-Vivek
You should read about Cassandra replication here: http://www.datastax.com/docs/1.1/cluster_architecture/replication