Skip to content

Commit

Permalink
Add support for setting the connection timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hoyt committed Mar 9, 2017
1 parent 1f32499 commit 0b58b07
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cassandradump.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ def setup_cluster():
auth = get_credentials
elif args.protocol_version > 1:
auth = PlainTextAuthProvider(username=args.username, password=args.password)
cluster = Cluster(contact_points=nodes, port=port, protocol_version=args.protocol_version, auth_provider=auth, load_balancing_policy=cassandra.policies.WhiteListRoundRobinPolicy(nodes), ssl_options=ssl_opts)

cluster = Cluster(control_connection_timeout=args.connect_timeout, connect_timeout=args.connect_timeout, contact_points=nodes, port=port, protocol_version=args.protocol_version, auth_provider=auth, load_balancing_policy=cassandra.policies.WhiteListRoundRobinPolicy(nodes), ssl_options=ssl_opts)
else:
cluster = Cluster(contact_points=nodes, port=port, load_balancing_policy=cassandra.policies.WhiteListRoundRobinPolicy(nodes), ssl_options=ssl_opts)
cluster = Cluster(control_connection_timeout=args.connect_timeout, connect_timeout=args.connect_timeout, contact_points=nodes, port=port, load_balancing_policy=cassandra.policies.WhiteListRoundRobinPolicy(nodes), ssl_options=ssl_opts)

session = cluster.connect()

Expand All @@ -347,6 +347,7 @@ def main():
global args

parser = argparse.ArgumentParser(description='A data exporting tool for Cassandra inspired from mysqldump, with some added slice and dice capabilities.')
parser.add_argument('--connect-timeout', help='set timeout for connecting to the cluster (in seconds)', type=int)
parser.add_argument('--cf', help='export a column family. The name must include the keyspace, e.g. "system.schema_columns". Can be specified multiple times', action='append')
parser.add_argument('--export-file', help='export data to the specified file')
parser.add_argument('--filter', help='export a slice of a column family according to a CQL filter. This takes essentially a typical SELECT query stripped of the initial "SELECT ... FROM" part (e.g. "system.schema_columns where keyspace_name =\'OpsCenter\'", and exports only that data. Can be specified multiple times', action='append')
Expand Down

0 comments on commit 0b58b07

Please sign in to comment.