I unable to install aerospike in mac

my aerospike service is running but i unable to run my code

import the module

from future import print_function import aerospike

Configure the client

config = { ‘hosts’: [ (‘127.0.0.1’, 2222) ] }

Create a client and connect it to the cluster

try: client = aerospike.client(config).connect() except Exception as err: print(err) 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()


How i check what is port of this and what is he host name

Are you running the server with Vagrant or in a Docker container? You may find these vagrant and docker articles useful in connecting a client to the server (specifically the port forwarding part).

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