Failed to connect to the cluster with [('127.0.0.1', 3000)]

Hi, I am a first-time aerospike user and I am trying to connect via a python app. The error code returned is -10(which indicates a client failure)

Here is the sample python code I am using 
   # import the module
from __future__ import print_function
import aerospike

# Configure the client
config = {
  'hosts': [ ('127.0.0.1', 3000) ]
}

# Create a client and connect it to the cluster
try:
  client = aerospike.client(config).connect()
except:
  import sys
  print("failed to connect to the cluster with", config['hosts'])
  sys.exit(1)

# Records are addressable via a tuple of (namespace, set, key)
key = ('test', 'demo', 'foo')

try:
  # Write a record
  client.put(key, {
    'name': 'John Doe',
    'age': 32
  })
except Exception as e:
  import sys
  print("error: {0}".format(e), file=sys.stderr)

# Read a record
(key, metadata, record) = client.get(key)
print(record)

# Close the connection to the Aerospike cluster
client.close()

My aerospike server and amc is connected. Any help would be appreciated.

Can someone help? Would really appreciate it.

Are you using docker?

Could you share your server configuration? Assuming docker, could you share the output of docker ps?

Could you describe your dev environment? Is the python running on the same vm or container? Are you using port-forwarding to access your vm or container? Is anything else running on port 3000?

This was solved.

How, What was the problem and how did it get solved. Would be helpful to share that, it will help others.

how did you solve it?

same error: Cant connect to aerospike-server in docker-compose.yml (Python client)

This topic was automatically closed 84 days after the last reply. New replies are no longer allowed.