cqlsh – Increase timeout limit

To change the client timeout limit in Apache Cassandra, there are two techniques:

Technique 1: This is a good technique: (https://issues.apache.org/jira/browse/CASSANDRA-7516)

1. Navigate to the following hidden directory under the home folder: (Create the hidden directory if not available)

$ pwd

2. Modify the file cqlshrc in it to an appropriate time in seconds: (Create the file if not available)

Original Setting:

$ more cqlshrc
client_timeout = 10
# Can also be set to None to disable:
# client_timeout = None

New Setting:

$ vi cqlshrc
$ more cqlshrc

client_timeout = 3600
# Can also be set to None to disable:
# client_timeout = None

Note: Here time is in seconds. Since, we wanted to increase the timeout to one hour. Hence, we have set it to 3600 seconds.

Technique 2: This is not a good technique since, you are changing the setting in the client program (cqlsh) itself.
Note: If you have already changed using technique 1 – then it will override the time specified using technique 2. Since, profile settings have highest priority.

1. Navigate to the path where cqlsh program is located. This you can find using the which command:

$ which cqlsh
$ pwd
$ ls -lrt cqlsh
-rwxr-xr-x 1 abc abc 93002 Nov  5 12:54 cqlsh

2. Open the program cqlsh and modify the time specified using the client_timeout variable. Note that time is specified in seconds.
$ vi cqlsh

In __init__ function:
    def __init__(self, hostname, port, color=False,
                 username=None, password=None, encoding=None, stdin=None, tty=True,
                 completekey=DEFAULT_COMPLETEKEY, use_conn=None,
                 cqlver=DEFAULT_CQLVER, keyspace=None,
                 tracing_enabled=False, expand_enabled=False,

In options.client_timeout setting:
    options.client_timeout = option_with_default(configs.get, ‘connection’, ‘client_timeout’, ’10’)

You can modify at both these places. The second line picks up client_timeout information from the cqlshrc file.

One thought on “cqlsh – Increase timeout limit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s