aerospike / aerospike-client-java

Aerospike Java Client Library
Other
236 stars 212 forks source link

Using Java client 4.1.7 connecting to AWS server show internal address and fails #101

Closed realmgic closed 6 years ago

realmgic commented 6 years ago

I'm trying to use Java client 4.1.7 to connect to AWS server (current version of server: 4.1.0.1) using the public IP, and that fails with an error that the local IP address is unknown. When using Java client 4.1.6, this works. This can be reproduced on multiple machines/servers at will.

Error message: com.aerospike.client.AerospikeException$Connection: Error Code -8: Failed to connect to host(s): 35.158.xxx.xxx 3000 Error Code -1: Invalid address: 172.31.xx.x:3000

NOTE: 35.158 is public IP - hidden the last bits, 172.31 is local IP - hidden the last bits.

BrianNichols commented 6 years ago

Java client version 4.1.7 added some load balancer detection logic that apparently does not work in all cases. For now, I recommend downgrading to 4.1.6.

We will let you know when this is fixed.

BrianNichols commented 6 years ago

Can you try the following info commands on your AWS server and reply with the results?

asinfo -v service-clear-std
asinfo -v service-clear-alt
asinfo -v peers-clear-std
asinfo -v peers-clear-alt

It's fine to hide the last bits of the IP addresses.

Also, are you setting a client internal/external IP address map translation (ClientPolicy.ipMap)?

realmgic commented 6 years ago

[aerotraining@ip-172-31-25-6 ~]$ asinfo -v service-clear-std WARNING: No module named jsonschema. Skipping Config file read. 172.31.25.6:3000 [aerotraining@ip-172-31-25-6 ~]$ asinfo -v service-clear-alt warning: No module named jsonschema. Skipping Config file read.172.31.25.6:3000[aerotraining@ip-172-31-25-6 ~]$ asinfo -v service-clear-altWARNING: No module named jsonschema. Skipping Config file read. [aerotraining@ip-172-31-25-6 ~]$ asinfo -v peers-clear-std WARNING: No module named jsonschema. Skipping Config file read. 1,,[] [aerotraining@ip-172-31-25-6 ~]$ asinfo -v peers-clear-alt WARNING: No module named jsonschema. Skipping Config file read. 1,,[] [aerotraining@ip-172-31-25-6 ~]$

(i'm booting the machine just for the test - so ip addresses are irrelevant - training is over)

I don't set any map translation - my test case is the training solution answer (https://github.com/aerospike-edu/student-workbook/tree/master/AS101/Java/solution)

BrianNichols commented 6 years ago

We think we have found the problem. Your server configuration does not have "access-address" defined. Therefore, the server returns the default AWS local IP address to the client. If you define "access-address" in your server configuration to be the server's public IP address, java client 4.1.7 should work.

Older java clients succeed because they do not ask for the server's "access-address" (via "service-clear-std"). We have decided to use the original seed if the server's "access-address" is invalid, so newer clients will also succeed under these conditions. This will be available in the next java client release.

Side note: It really is important to define "access-address" for multi-node AWS clusters because clients would otherwise not be able to connect to other nodes defined in the server's peer list. You can get away with not defining "access-address" on a single-node AWS cluster only because the node's peers list is empty.

realmgic commented 6 years ago

Great, thanks!