Creating and using the cqlshrc file

The cqlshrc file passes default configuration information to cqlsh.

The cqlshrc file can pass default configuration information to cqlsh. Use the cqlshrc file to configure SSL encryption instead of overriding the SSL_CERTFILE environmental variables repeatedly. To help you create this file, Apache Cassandra includes a cqlshrc.sample file. Copy this file to the hidden .cassandra directory in your user home folder and rename it to cqlshrc.

Options for cqlshrc

You configure the cqlshrc file by setting these options in the following sections:

[authentication] options

Note: Cassandra internal authentication must be configured before users can use the authentication options. For more information, see Using cqlsh with SSL encryption.
username
Authenticate as user.
password
Authenticate using password.
keyspace
Use the given keyspace. Equivalent to issuing a USE keyspace command immediately after starting cqlsh.

[ui] options

color
Always use color output.
datetimeformat
Configure the format of timestamps using Python strftime syntax and reading them with COPY.
float_precision
Sets the number of digits displayed after the decimal point.
Note: Increasing this to large numbers can result in unusual values.
completekey
Set the key for automatic completion of a cqlsh shell entry. Default is the tab key.

[cql] option

version
Sets which version of CQL to use. This should rarely be used.

[connection] option (Cassandra 2.1.1+)

hostname
The host for the cqlsh connection.
port
The connection port. Default: 9042 (native protocol).
timeout
Configures timeout in seconds for opening new connections.
request_timeout
Configures the request timeout in seconds for executing queries. Set to the number of seconds of inactivity.

[csv] option (Cassandra 2.1.5+)

field_size_limit
Configures the cqlsh field size. Set to a particular field size. For instance, field_size_limit (1000000000).

[tracing] option

max_trace_wait
The maximum number of seconds to wait for a trace to complete.

[ssl] options

certfile
The path to the cassandra certificate. See Using cqlsh with SSL encryption in the Cassandra documentation.
validate
Optional. Default: true.
userkey
Must be provided when require_client_auth=true in cassandra.yaml.
usercert
Must be provided when require_client_auth=true in cassandra.yaml.

[certfiles] options

Overrides default certfiles in [ssl] section.

Common COPY TO and COPY FROM options

Also see the Common COPY options for TO and FROM table.

nullval
The string placeholder for null values.
header
For COPY TO, controls whether the first line in the CSV output file contains the column names.
For COPY FROM, specifies whether the first line in the CSV file contains column names.
decimalsep
Set a separator for decimal values.
thousandssep
Set a separator for thousands digit groups. Default: empty string.
boolstyle
Set a representation for boolean values for True and False. The values are case insensitive. Example: yes,no or 1,0.
numprocesses
Set the number of worker processes. Maximum value is 16.
maxattempts
Set the maximum number of attempts for errors.
reportfrequency
Set the frequency with which status is displayed, in seconds.
ratefile
Specify a file for printing output statistics.

COPY TO options

Also see the COPY TO table.

maxrequests
Set the maximum number of requests each worker process can work on in parallel.
pagesize
Set the page size for fetching results.
pagetimeout
Set the page timeout for fetching results.
begintoken
Set the minimum token string for exporting data.
endtoken
Set the maximum token string for exporting data.
Set the maximum size of the output file, measured in number of lines. If a value is set, the output file will be split into segment when the value is exceeded. "-1" sets no maximum.
encoding
Set the COPY TO command to output unicode strings.

COPY FROM options

Also see the COPY FROM table.

ingestrate
Set an approximate ingest rate in rows per second. Must be set to a greater value than chunk size.
maxrows
Set the maximum number of rows. "-1" sets no maximum.
skiprows
The number of rows to skip.
skipcols
Set a comma-separated list of column names to skip.
maxparseerrors
Set the maximum global number of parsing errors. "-1" sets no maximum.
maxinserterrors
Set the maximum global number of insert errors. "-1" sets no maximum.
errfile
Set a file to store all rows that are not imported. If no value is set, the information is stored in import_ks_table.err where <ks> is the keyspace and <table> is the table name.
maxbatchsize
Set the maximum size of an import batch.
minbatchsize
Set the minimum size of an import batch.
chunksize
Set the size of chunks passed to worker processes.

COPY options

Also see the COPY table.

chunksize
Set the size of chunks passed to worker processes.
ingestrate
Set an approximate ingest rate in rows per second. Must be set to a greater value than chunk size.
pagetimeout
Set the page timeout for fetching results.