It’s a proprietary application, so I can’t really show the namespaces and sets. When I run ‘show scans’ in aql it looks like the scan is running. I just get no output.
Here’s the stripped down code:
#!/usr/bin/env python
from __future__ import print_function
import sys
import aerospike
def connect(host,port):
""" Connect to Aerospike. """
config = { 'hosts': [(host,port)] }
client = None
try:
client = aerospike.client(config).connect()
except:
print("Failed to connect to Aerospike.")
client = None
return client
def check_record((key,metadata,record)):
write(".")
sys.stdout.flush()
def scan_records(host,port,namespace,set):
"""
Connect to the specified Aerospike host and port and begin scanning.
"""
client = connect(host,port)
if (client is not None):
print("Connected to Aerospike.")
print("Configuring scan.")
scan = client.scan(namespace,set)
print("Starting scan.")
scan.foreach(check_record)
print("Scan complete.")
client.close()
if __name__ == "__main__":
if len(sys.argv) == 5:
scan_records(sys.argv[1],int(sys.argv[2]),sys.argv[3],sys.argv[4])
else:
print("Usage: "
+ sys.argv[0]
+ "<aerospike-host> <aerospike-port> <namespace> <set>")
sys.exit(0)
Do you see anything obviously wrong?
Thanks.