0

I've the aerospike instance in the AWS EC2. I can connect through putty but I try through java code (Java client). I can't connect to the aerospike.

AerospikeClient client = new AerospikeClient("IP-address", 3000);
System.out.println(client.isConnected());

"IP-address" I try out followings

Amazon EC2 instance

  1. private IP
  2. public IP
  3. private DNS
  4. public DNS

unfortunately prints system connected false. Any idea about this?

kporter
  • 2,684
  • 17
  • 26
Damith Ganegoda
  • 4,100
  • 6
  • 37
  • 46

1 Answers1

2
  1. You should be using the public IP/DNSname if you are trying your code from a machine outside amazon(/your VPC in amazon).
  2. If you are trying from outside amazon (like your laptop), the latency will be very high. In general, its not advisable. Ideally, the client should be running in the same lan as the server. But you can try few things
    1. Put sleep between AerospikeClient() & isConnected(). This will let the client layer discover the cluster.
    2. Call AerospikeClient() with ClientPolicy() arg whose timeout is set to a much higher value than the default 1000ms.
sunil
  • 3,507
  • 18
  • 25