import aerospike
import logging
import ssl
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s.%(msecs)03d [%(levelname)-7s] - [Pod: ss7psmf-1] : %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
config = {
"hosts": [("ig-aerospike-service.ig1.svc.cluster.local", 3010)],
"tls": {
"enable": True,
"cafile": "/opt/tpa/conf/sac/aerospikecerts/root-cert.pem",
"keyfile": "/opt/tpa/conf/sac/aerospikecerts/key.pem",
"certfile": "/opt/tpa/conf/sac/aerospikecerts/cert-chain.pem",
"tls_name": "*.dyn.nesc.nokia.net",
"verify": False,
"protocols": "TLSv1.2" # Match C/C++ client, adjust if needed
},
"policies": {
"timeout": 5000,
"max_retries": 3,
"retry_on_timeout": True
}
}
try:
logging.debug("OpenSSL version: %s", ssl.OPENSSL_VERSION)
logging.debug("Attempting to connect with config: %s", config)
client = aerospike.client(config)
client.connect()
logging.info("Connected: %s", client.is_connected())
client.close()
except aerospike.exception.ClientError as e:
logging.error("Failed to connect: %s", e)
except Exception as e:
logging.error("Unexpected error: %s", e)
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
ss7psmf-1 linus> python3 test5.py
2025-07-16 09:28:12.923 [DEBUG ] - [Pod: ss7psmf-1] : OpenSSL version: OpenSSL 1.1.1k FIPS 25 Mar 2021
2025-07-16 09:28:12.923 [DEBUG ] - [Pod: ss7psmf-1] : Attempting to connect with config: {'hosts': [('ig-aerospike-service.ig1.svc.cluster.local', 3010)], 'tls': {'enable': True, 'cafile': '/opt/tpa/conf/sac/aerospikecerts/root-cert.pem', 'keyfile': '/opt/tpa/conf/sac/aerospikecerts/key.pem', 'certfile': '/opt/tpa/conf/sac/aerospikecerts/cert-chain.pem', 'tls_name': '*.dyn.nesc.nokia.net', 'verify': False, 'protocols': 'TLSv1.2'}, 'policies': {'timeout': 5000, 'max_retries': 3, 'retry_on_timeout': True}}
2025-07-16 09:28:12.959 [ERROR ] - [Pod: ss7psmf-1] : Failed to connect: (-10, 'Failed to connect', 'src/main/aerospike/as_cluster.c', 395, False)`Preformatted text`