RPC timeout in cqlsh - Cassandra

flowerpot picture flowerpot · Mar 6, 2013 · Viewed 15k times · Source

I have 5 nodes in my ring with SimpleTopologyStrategy and replication_factor=3. I inserted 1M rows using stress tool . When am trying to read the row count in cqlsh using

SELECT  count(*) FROM  Keyspace1.Standard1 limit 1000000;

It fails with error:

Request did not complete within rpc_timeout.

It fetches for limit 100000. Fails even for 500000.
All my nodes are up. Do I need to increase the rpc_timeout?

Please help.

Answer

Pelle picture Pelle · Aug 13, 2015

You get this error because the request is timing out on the server side. One should know that this is a very expensive operation in Cassandra as others have pointed out.

Still, if you really want to do this you should update your /etc/cassandra/cassandra.yaml file and change the range_request_timeout_in_ms parameter. This will be valid for all your range queries.

Example to set a 40 second timeout:

range_request_timeout_in_ms: 40000

You will probably have to adjust at the client side as well. When using cqlsh as a client this is accomplished by creating/updating your configuration file for cqlsh under ~/.cassandra/cqlshrc and add the client_timeout parameter to the connection section.

Example to set a 40 second timeout:

[connection]
client_timeout=40