Security enabled, exception.NotAuthenticated: (80L, 'Failed to connect', 'src/main/aerospike/as_cluster.c', 254, False)

Hi running Aerospike enterprise edition, using python client to connect to aerospike.

The code is as follows:

 
 # aerospike class variables
  dbHost = "rhes75"
  dbPort = 3000
  dbConnection = "mich"
  namespace = "test"
  dbPassword = "xxxxxxxx"
  dbSet = "oracletoaerospike2"

    # Check aerospike is accessible
    try:
      config = {
          'hosts': [(self.dbHost, self.dbPort)]
      }
      client = aerospike.client(config).connect([self.dbConnection, self.dbPassword])
    except ClientError as e:
      print("Error: {0} [{1}]".format(e.msg, e.code))
      sys.exit(1)
    else:
        print("Connection successful")
        client.close()
        sys.exit(0)

 I am getting this error

Traceback (most recent call last):
  File "./read_oracle_table.py", line 88, in <module>
    a.read_aerospike_set()
  File "./read_oracle_table.py", line 76, in read_aerospike_set
    client = aerospike.client(config).connect([self.dbConnection, self.dbPassword])
exception.NotAuthenticated: (80L, 'Failed to connect', 'src/main/aerospike/as_cluster.c', 254, False)

and the audit log shows

Nov 11 20:46:15 rhes75 asd: not authenticated | client: 50.140.197.220:39086 | authenticated user: <none> | action: info request | detail: <none>

So it cannot see the username. The documentation says:

connect([username, password])
Connect to the cluster. The optional username and password only apply when connecting to the Enterprise Edition of Aerospike.
Parameters
username (str) – a defined user with roles in the cluster. See admin_create_user().
password (str) – the password will be hashed by the client using bcrypt.
Raises
ClientError, for example when a connection cannot be established to a seed node (any single node in the cluster from which the client learns of the other nodes).

Thanks

With a clarification from Ronan Botzer , this is resolved :slight_smile:

The issue was that I interpreted the as part of the syntax

connect([username, password])

So the correct code is:

client = aerospike.client(config).connect(self.dbConnection, self.dbPassword)

HTH

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.