"The bind address of this member. The difference between localMemberHost & localMemberBindAddress
is that localMemberHost is the one that is advertised by this member, while localMemberBindAddress
is the address to which this member is bound to."
We are in the process of making API Manager components HA ready. As a result of that, we are upgrading configurations as per the cluster guide. HazelcastClusteringAgent configs are getting updated as well. As I quoted at the top most section provided comment is bit unclear, much appreciated if you can eloborate more. Furthermore, would like to know that, this is still a valid set of parameters that need to be fulfilled if we are following the AWS clustering configs for Hazelcast.
In the event of AWS clustering the bind address is constructed (if using aws discovery) by the resulting IP address returned from the ec2:describe instances and the configured listen port (5701 default). So you would not set the bind address it is set by the plugin.
Related
I've been getting an amazon instance ID from within the instance itself for over a year now by hitting this local web address http://169.254.169.254/latest/meta-data/instance-id. This is the appropriate method according to the AWS documentation. For some reason though, just this week that same call started throwing an error.
I tried pinging the 169.254.169.254 address from the command line and that fails, so it seems like something pretty basic has changed with the EC2 instances. I don't see any changes to the documentation on AWS. One thing I do notice is that I used to see the instance name in the upper right hand corner when loading up the instance and logging in remotely. That information doesn't appear anymore.
Here is the code I've been using to get the ID:
retID = New StreamReader(HttpWebRequest.Create("http://169.254.169.254/latest/meta-data/instance-id").GetResponse().GetResponseStream()).ReadToEnd()
Here is the full error stack:
at System.Net.HttpWebRequest.GetResponse()
at RunControllerInterface.NewRunControlCommunicate.getInstanceIDFromAmazon()
The error message itself says: Unable to connect to the remote server
Any help would be appreciated.
So I think I have at least a partial answer to this problem. When making this image, I was using a t3a.medium instance. As long as I use that same type of instance I am able to pull down the instance name.
When using C++ driver to create APIs for interacting with Cassandra, the C++ program has to be provided a comma separated list, which contains the IP addresses of the nodes which the driver can use as the contact point(cass_cluster_set_contact_points) to the database. I wanted to understand the role of this contact point and if it plays a different role than the coordinator node i.e. is the contact point and the coordinator node one and the same thing.
Also when we are executing, say, a multi-threaded program, for executing several queries, is the coordinator node/contact-point selected for each query or is it just selected at the beginning and then that node is fixed as the coordinator node throughout the execution of the program.
The contact endpoints simply serve as a way for your driver to discover the cluster. You really only need to provide two or three, and the driver will figure out the remaining endpoints via gossip.
When you connect, it is a good idea is to use the TokenAwareLoadBalancingPolicy. That will cause any query filtering on a partition key to bypass the need for a coordinator node, and route directly to the node which is responsible for the required data.
If a query is not filtering on a partition key, or if it is a multi-key query, then an exact node cannot be determined. At that point, your backup load balancing policy (the TokenAwareLoadBalancingPolicy takes a backup policy as an argument) will be used to determine a coordinator node. If I remember right the DCAwareRoundRobinLoadBalancingPolicy is the default.
In summary, the connection endpoints only serve for cluster discovery. The coordinator node is chosen at query-time, based on algorithms used in your load balancing policy.
The contact points, which are mentioned in the program are used by the cluster connection setup. The gossip will fetch the entire cluster connection setup based on those ip addresses. The gossip will maintain the ip addresses and other properties of the node and it will always looks whether there is change in the setup and will update everytime if the configuration changes.
If a write or read request happens on ip1, with cluster connected to hosts as ip1, ip2 & ip3, then ip1 is the co-ordinator for this particular operation. It acts as a proxy to process the operation, and redirects the operation to the respective node,say ip4 which is in the cluster but not in the contact list, based on different properties, how the cluster is set up and policies like TokenAwareLoadBalancingPolicy. You can have a look at this article by datastax : https://docs.datastax.com/en/archived/cassandra/1.2/cassandra/architecture/architectureClientRequestsAbout_c.html
I have a Java web app that persists some things to a database and I would like to know what instance processed the order. A quick google and SO search wasn't fruitful in answering my question:
Is there an environment variable or something that my application can use to glean an instance number from for persisting?
I assume that by "what instance" you mean that you have multiple instances of your Java application, and you want some way of knowing which of the multiple instances actually made the request to the database.
Googling "Cloud Foundry Instance Environment Variable" leads me to this first result. You can see one of the listed variables is CF_INSTANCE_INDEX. Those docs are for Pivotal's hosted Cloud Foundry service, I guess the OSS docs have worse SEO, but they also document this.
Do note that application instances are ephemeral. Instance #0 might be killed and restarted for any number of reasons (usually either because your application crashes, or the underlying application execution software/OS are being upgraded in a rolling deploy fashion so your instances are being transparently moved around to avoid downtime), in which case the new instance #0 will obviously be an entirely different process, possibly running on a different machine, in a different datacenter.
From the logs, you can see the APP instance
2015-11-13T11:44:42.000+00:00 [App/0] OUT 11:44:42.675 [main] INFO blah blah
2015-11-13T11:45:42.000+00:00 [App/1] OUT 11:45:42.676 [main] INFO blah2
here App/0 is instance 0 & App/1 is instance 1.
Or if you want to access the instance in the code,
Look out for the env var, CF_INSTANCE_*
eg; CF_INSTANCE_INDEX, CF_INSTANCE_IP, CF_INSTANCE_PORT etc
I am making a describeCacheClusters request as follows and get a valid response but the getCacheClusters() method returns null even though that cluster has available nodes. Is there another request I should be using or a missing parameter?
DescribeCacheClustersResult result = awsClient
.describeCacheClusters(new DescribeCacheClustersRequest()
.withCacheClusterId(ELASTICACHE_CLUSTER_ID));
You are missing a parameter indeed due to a somewhat confusing API design resp. documentation issue with Amazon ElastiCache:
You need to add setShowCacheNodeInfo() to your DescribeCacheClustersRequest and call getCacheNodes() for each CacheCluster retrieved via getCacheClusters() from the DescribeCacheClustersResult - see my answer to the semantic duplicate Finding AWS ElastiCache endpoints with Java for details and code samples.
Although easily done from my perspective with IIS, I'm a total noob to Tomcat and have no idea how to set static values for cookie contents. Yes I've read the security implications and eventually will access via SSL so I'm not concerned. Plus I've read the Servlet 3.0 spec about not changing the value and I accept that.
In IIS I would simply set a HTTP Header named Set-Cookie with an arbitrary setting of WebServerSID and a value of 1001.
Then in the load balancer VIP containing this group of real servers, set the value WebServerSID at the VIP level, and for the first web server a cookie value of 1001 and so one for the remaining machines 1002 for server 2, 1003 for server 3.
This achieves session affinity via cookies until the client closes the browser.
How can this be done with Tomcat 7.0.22?
I see a great deal of configuration changes have occurred between Tomcat 6.x and 7.x with regard to cookies and how they're set up. I've tried the following after extensive research
over the last week.
In web.xml: (this will disable URL rewriting under Tomcat 7.x)
<tracking-mode>COOKIE</tracking-mode> under the default session element
In context.xml: (cookies is true by default but I was explicit as I can't get it working)
cookies=true
sessionCookiePath=/
sessionCookieName=WebServerSID
sessionCookieName=1001
I have 2 entries in context.xml for sessionCookieName because the equivalent commands from Tomcat 6.x look like they've been merged into 1.
See http://tomcat.apache.org/migration-7.html#Tomcat_7.0.x_configuration_file_differences
Extract:
org.apache.catalina.SESSION_COOKIE_NAME system property: This has been removed. An equivalent effect can be obtained by configuring the sessionCookieName attribute for the global context.xml (in CATALINA_BASE/conf/context.xml).
org.apache.catalina.SESSION_PARAMETER_NAME system property: This has been removed. An equivalent effect can be obtained by configuring the sessionCookieName attribute for the global context.xml (in CATALINA_BASE/conf/context.xml).
If this is not right then I simply do not understand the syntax that is required and I cannot find anywhere that will simply spell it out in plain black and white.
Under Tomcat 6.x, I would have used Java Options in the config like:
-Dorg.apache.catalina.SESSION_COOKIE_NAME=WebServerSID
-Dorg.apache.catalina.SESSION_PARAMETER_NAME=1001
The application I'm using does not have any of these values set elsewhere so it's not the application.
All these settings are in context/web/server.xml files at the Catalina base
At the end of the day what I need to see in the response headers under Set-Cookies: (as seen using Fiddler) is:
WebServerSID=1001
NOT
JSESSIONID=as8sd9787ksjds9d8sdjks89s898
thanks in advance
regards
The best you can do purely with configuration is to set the jvmRoute attribute of the Engine which will add the constant value to the end of the session ID. Most load-balancers can handle that. It would look like:
JSESSIONID=as8sd9787ksjds9d8sdjks89s898.route1
If that isn't good enough and you need WebServerSID=1001 you'll have to write a ServletFilter and configure that to add the header on every response.