blob: cc838f83015a902541d63af8ecb197a131daf850 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Help file for online commands in Yaml.
banner: |
Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.
help: |
Getting around:
? Display this help.
help; Display this help.
help <command>; Display command-specific help.
exit; Exit this utility.
quit; Exit this utility.
Commands:
assume Apply client side validation.
connect Connect to a Cassandra node.
consistencylevel Sets consisteny level for the client to use.
count Count columns or super columns.
create column family Add a column family to an existing keyspace.
create keyspace Add a keyspace to the cluster.
del Delete a column, super column or row.
decr Decrements a counter column.
describe cluster Describe the cluster configuration.
describe Describe a keyspace and its column families or column family in current keyspace.
drop column family Remove a column family and its data.
drop keyspace Remove a keyspace and its data.
drop index Remove an existing index from specific column.
get Get rows and columns.
incr Increments a counter column.
list List rows in a column family.
set Set columns.
show api version Show the server API version.
show cluster name Show the cluster name.
show keyspaces Show all keyspaces and their column families.
show schema Show a cli script to create keyspaces and column families.
truncate Drop the data in a column family.
update column family Update the settings for a column family.
update keyspace Update the settings for a keyspace.
use Switch to a keyspace.
commands:
- name: NODE_HELP
help: |
help <command>;
Display the general help page with a list of available commands.;
- name: NODE_CONNECT
help: |
connect <hostname>/<port> (<username> '<password>')?;
Connect to the a Cassandra node on the specified port.
If a username and password are supplied the login will occur when the
'use' statement is executed. If the server does not support authentication
it will silently ignore credentials.
For information on configuring authentication and authorisation see the
conf/cassandra.yaml file or the project documentation.
Required Parameters:
- hostname: Machine name or IP address of the node to connect to.
- port: rpc_port to connect to the node on, as defined in
conf/Cassandra.yaml for the node. The default port is 9160.
Optional Parameters:
- password: Password for the supplied username.
- username: Username to authenticate to the node as.
Examples:
connect localhost/9160;
connect localhost/9160 user 'badpasswd';
connect 127.0.0.1/9160 user 'badpasswd';
- name: NODE_USE_TABLE
help: |
use <keyspace>;
use <keyspace> <username> '<password>';
Use the specified keyspace.
If a username and password are supplied they will be used to authorize
against the keyspace. Otherwise the credentials supplied to the 'connect'
statement will be used to authorize the user . If the server does not
support authentication it will silently ignore credentials.
Required Parameters:
- keyspace: Name of the keyspace to use. The keyspace must exist.
Optional Parameters:
- password: Password for the supplied username.
- username: Username to login to the node as.
Examples:
use Keyspace1;
use Keyspace1 user 'badpasswd';
- name: NODE_DESCRIBE
help: |
describe;
describe <keyspace>;
describe <column_family>;
Describes the settings for the current or named keyspace, or the settings
of the column family in the current authenticated keyspace.
Optional Parameters:
- keyspace: Name of the keyspace to describe.
- column_family: Name of the column family to describe.
Examples:
describe; - Describes current authenticated keyspace
describe <keyspace>; - Describe this keyspace
describe <column_family>; - Describe the colum family in the current authenticated keyspace
- name: NODE_DESCRIBE_CLUSTER
help: |
describe cluster;
Describes the snitch, partitioner and schema versions for the currently
connected cluster.
NOTE: The cluster should only report one schema version. Multiple versions
may indicate a failed schema modification, consult the project documentation.
Examples:
describe cluster;
- name: NODE_EXIT
help: |
exit;
quit;
Exit this utility.
Examples:
exit;
quit;
- name: NODE_SHOW_CLUSTER_NAME
help: |
show cluster name;
Displays the name of the currently connected cluster.
Examples:
show cluster name;
- name: NODE_SHOW_VERSION
help: |
show api version;
Displays the API version number.
This version number is used by high level clients and is not the same as
the server release version.
Examples:
show api version;
- name: NODE_SHOW_KEYSPACES
help: |
show keyspaces;
Describes the settings and the column families for all keyspaces on the
currently connected cluster.
Examples:
show keyspaces;
- name: NODE_SHOW_SCHEMA
help: |
show schema;
show schema <keyspace>;
Creates a CLI script to create the current, specified or all keyspaces
and their column families.
Optional Parameters:
- keyspace: Name of the keyspace to create the script for. If omitted
the current keyspace is used, if there is no current keyspace all
keyspaces are considered.
Examples:
show schema;
show schema Keyspace1;
- name: NODE_ADD_KEYSPACE
help: |
create keyspace <keyspace>;
create keyspace <keyspace> with <att1>=<value1>;
create keyspace <keyspace> with <att1>=<value1> and <att2>=<value2> ...;
Create a keyspace with the specified attributes.
Required Parameters:
- keyspace: Name of the new keyspace, "system" is reserved for
Cassandra internals. Names may only contain letters, numbers and
underscores.
Keyspace Attributes (all are optional):
- placement_strategy: Class used to determine how replicas
are distributed among nodes. Defaults to NetworkTopologyStrategy with
one datacenter defined with a replication factor of 1 ("[datacenter1:1]").
Supported values are:
- org.apache.cassandra.locator.SimpleStrategy
- org.apache.cassandra.locator.NetworkTopologyStrategy
- org.apache.cassandra.locator.OldNetworkTopologyStrategy
SimpleStrategy merely places the first replica at the node whose
token is closest to the key (as determined by the Partitioner), and
additional replicas on subsequent nodes along the ring in increasing
Token order.
Supports a single strategy option 'replication_factor' that
specifies the replication factor for the cluster.
With NetworkTopologyStrategy, for each datacenter, you can specify
how many replicas you want on a per-keyspace basis. Replicas are
placed on different racks within each DC, if possible.
Supports strategy options which specify the replication factor for
each datacenter. The replication factor for the entire cluster is the
sum of all per datacenter values. Note that the datacenter names
must match those used in conf/cassandra-topology.properties.
OldNetworkToplogyStrategy [formerly RackAwareStrategy]
places one replica in each of two datacenters, and the third on a
different rack in in the first. Additional datacenters are not
guaranteed to get a replica. Additional replicas after three are
placed in ring order after the third without regard to rack or
datacenter.
Supports a single strategy option 'replication_factor' that
specifies the replication factor for the cluster.
- strategy_options: Optional additional options for placement_strategy.
Options have the form {key:value}, see the information on each
strategy and the examples.
- durable_writes: When set to false all Mutations on keyspace will by-pass CommitLog.
Set to true by default.
Examples:
create keyspace Keyspace2
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:4};
create keyspace Keyspace3
with placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy'
and strategy_options={DC1:2, DC2:2};
create keyspace Keyspace4
with placement_strategy = 'org.apache.cassandra.locator.OldNetworkTopologyStrategy'
and strategy_options = {replication_factor:1};
- name: NODE_UPDATE_KEYSPACE
help: |
update keyspace <keyspace>;
update keyspace <keyspace> with <att1>=<value1>;
update keyspace <keyspace> with <att1>=<value1> and <att2>=<value2> ...;
Update a keyspace with the specified attributes.
Note: updating some keyspace properties may require additional maintenance
actions. Consult project documentation for more details.
Required Parameters:
- keyspace: Name of the keyspace to update.
Keyspace Attributes (all are optional):
- placement_strategy: Class used to determine how replicas
are distributed among nodes. Defaults to NetworkTopologyStrategy with
one datacenter defined with a replication factor of 1 ("[datacenter1:1]").
Supported values are:
- org.apache.cassandra.locator.SimpleStrategy
- org.apache.cassandra.locator.NetworkTopologyStrategy
- org.apache.cassandra.locator.OldNetworkTopologyStrategy
SimpleStrategy merely places the first replica at the node whose
token is closest to the key (as determined by the Partitioner), and
additional replicas on subsequent nodes along the ring in increasing
Token order.
Supports a single strategy option 'replication_factor' that
specifies the replication factor for the cluster.
With NetworkTopologyStrategy, for each datacenter, you can specify
how many replicas you want on a per-keyspace basis. Replicas are
placed on different racks within each DC, if possible.
Supports strategy options which specify the replication factor for
each datacenter. The replication factor for the entire cluster is the
sum of all per datacenter values. Note that the datacenter names
must match those used in conf/cassandra-topology.properties.
OldNetworkToplogyStrategy [formerly RackAwareStrategy]
places one replica in each of two datacenters, and the third on a
different rack in in the first. Additional datacenters are not
guaranteed to get a replica. Additional replicas after three are
placed in ring order after the third without regard to rack or
datacenter.
Supports a single strategy option 'replication_factor' that
specifies the replication factor for the cluster.
- strategy_options: Optional additional options for placement_strategy.
Options have the form {key:value}, see the information on each
strategy and the examples.
- durable_writes: When set to false all Mutations on keyspace will by-pass CommitLog.
Set to true by default.
Examples:
update keyspace Keyspace2
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:4};
update keyspace Keyspace3
with placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy'
and strategy_options={DC1:2, DC2:2};
update keyspace Keyspace4
with placement_strategy = 'org.apache.cassandra.locator.OldNetworkTopologyStrategy'
and strategy_options = {replication_factor:1};
- name: NODE_ADD_COLUMN_FAMILY
help: |
create column family <name>;
create column family <name> with <att1>=<value1>;
create column family <name> with <att1>=<value1> and <att2>=<value2>...;
Create a column family in the current keyspace with the specified
attributes.
Required Parameters:
- name: Name of the new column family. Names may only contain letters,
numbers and underscores.
column family Attributes (all are optional):
- column_metadata: Defines the validation and indexes for known columns in
this column family.
Columns not listed in the column_metadata section will use the
default_validator to validate their values.
Column Required parameters:
- name: Binds a validator (and optionally an indexer) to columns
with this name in any row of the enclosing column family.
- validator: Validator to use for values for this column.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
- CompositeType (should be used with sub-types specified e.g. 'CompositeType(UTF8Type, Int32Type)'
quotes are important (!) in this case)
It is also valid to specify the fully-qualified class name to a class
that extends org.apache.cassandra.db.marshal.AbstractType.
Column Optional parameters:
- index_name: Name for the index. Both an index name and
type must be specified.
- index_type: The type of index to be created.
Suported values are:
- KEYS: a ColumnFamily backed index
- CUSTOM: a user supplied index implementaion. You must supply a
'class_name' field in the index_options with the full classname
of the implementation.
- index_options: Optional additional options for index_type.
Options have the form {key:value}.
- bloom_filter_fp_chance: Desired false positive probability for
sstable row bloom filters. Default is 0.000744.
- index_interval: controls the sampling of entries from the primrary
row index in terms of space versus time. The larger the interval,
the smaller and less effective the sampling will be. All the sampled
entries must fit in memory. Default value is 128.
- column_type: Type of columns this column family holds, valid values are
Standard and Super. Default is Standard.
- comment: Human readable column family description.
- comparator: Validator to use to validate and compare column names in
this column family. For Standard column families it applies to columns, for
Super column families applied to super columns. Also see the subcomparator
attribute. Default is BytesType, which is a straight forward lexical
comparison of the bytes in each column.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
- CompositeType (should be used with sub-types specified e.g. 'CompositeType(UTF8Type, Int32Type)'
quotes are important (!) in this case)
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- default_validation_class: Validator to use for values in columns which are
not listed in the column_metadata. Default is BytesType which applies
no validation.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
- CompositeType (should be used with sub-types specified e.g. 'CompositeType(UTF8Type, Int32Type)'
quotes are important (!) in this case)
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- key_validation_class: Validator to use for keys.
Default is BytesType which applies no validation.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- gc_grace: Time to wait in seconds before garbage collecting tombstone
deletion markers. Default value is 864000 or 10 days.
Set this to a large enough value that you are confident that the deletion
markers will be propagated to all replicas by the time this many seconds
has elapsed, even in the face of hardware failures.
See http://wiki.apache.org/Cassandra/DistributedDeletes
- read_repair_chance: Probability (0.0-1.0) with which to perform read
repairs for any read operation. Default is 0.1.
Note that disabling read repair entirely means that the dynamic snitch
will not have any latency information from all the replicas to recognize
when one is performing worse than usual.
- dclocal_read_repair_chance: Probability (0.0-1.0) with which to
perform read repairs against the node from the local data-center. If
this is lower than read_repair_chance, this will be ignored.
Example:
update column family Standard2
with read_repair_chance=0.1
and dclocal_read_repair_chance=0.5;
For 10 read queries, 1 will do read repair on all replicas (and
thus in particular on all replica of the local DC), 4 will only do
read repair on replica of the local DC and 5 will not do any read
repair.
- subcomparator: Validator to use to validate and compare sub column names
in this column family. Only applied to Super column families. Default is
BytesType, which is a straight forward lexical comparison of the bytes in
each column.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- max_compaction_threshold: The maximum number of SSTables allowed before a
minor compaction is forced. Default is 32, setting to 0 disables minor
compactions.
Decreasing this will cause minor compactions to start more frequently and
be less intensive. The min_compaction_threshold and max_compaction_threshold
boundaries are the number of tables Cassandra attempts to merge together at
once.
- min_compaction_threshold: The minimum number of SSTables needed
to start a minor compaction. Default is 4, setting to 0 disables minor
compactions.
Increasing this will cause minor compactions to start less frequently and
be more intensive. The min_compaction_threshold and max_compaction_threshold
boundaries are the number of tables Cassandra attempts to merge together at
once.
- compression_options: Options related to compression.
Options have the form {key:value}.
The main recognized options are:
- sstable_compression: the algorithm to use to compress sstables for
this column family. If none is provided, compression will not be
enabled. Supported values are SnappyCompressor, DeflateCompressor or
any custom compressor. It is also valid to specify the fully-qualified
class name to a class that implements org.apache.cassandra.io.ICompressor.
- chunk_length_kb: specify the size of the chunk used by sstable
compression (default to 64, must be a power of 2).
To disable compression just set compression_options to null like this
`compression_options = null`.
Examples:
create column family Super4
with column_type = 'Super'
and comparator = 'AsciiType'
and caching='ALL';
create column family Standard3
with comparator = 'LongType'
and caching='ALL';
create column family Standard4
with comparator = AsciiType
and column_metadata =
[{
column_name : Test,
validation_class : IntegerType,
index_type : 0,
index_name : IdxName},
{
column_name : 'other name',
validation_class : LongType
}];
create column family UseComposites
with comparator = 'CompositeType(UTF8Type, Int32Type)'
and caching='ALL';
- name: NODE_UPDATE_COLUMN_FAMILY
help: |
update column family <name>;
update column family <name> with <att1>=<value1>;
update column family <name> with <att1>=<value1> and <att2>=<value2>...;
Updates the settings for a column family in the current keyspace.
Required Parameters:
- name: Name of the column family to update.
column family Attributes (all are optional):
- column_metadata: Defines the validation and indexes for known columns in
this column family.
Columns not listed in the column_metadata section will use the
default_validator to validate their values.
Column Required parameters:
- name: Binds a validator (and optionally an indexer) to columns
with this name in any row of the enclosing column family.
- validator: Validator to use for values for this column.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
- CompositeType (should be used with sub-types specified e.g. 'CompositeType(UTF8Type, Int32Type)'
quotes are important (!) in this case)
It is also valid to specify the fully-qualified class name to a class
that extends org.apache.cassandra.db.marshal.AbstractType.
Column Optional parameters:
- index_name: Name for the index. Both an index name and
type must be specified.
NOTE: After the update has completed the column family will only
contain the secondary indexes listed in the update statement. Existing
indexes will be dropped if they are not present in the update.
- index_type: The type of index to be created.
Suported values are:
- KEYS: a ColumnFamily backed index
- CUSTOM: a user supplied index implementaion. You must supply a
'class_name' field in the index_options with the full classname
of the implementation.
- index_options: Optional additional options for index_type.
Options have the form {key:value}.
- bloom_filter_fp_chance: Desired false positive probability for
sstable row bloom filters. Default is 0.000744.
- column_type: Type of columns this column family holds, valid values are
Standard and Super. Default is Standard.
- comment: Column family description.
- comparator: Validator to use to validate and compare column names in
this column family. For Standard column families it applies to columns, for
Super column families applied to super columns. Also see the subcomparator
attribute. Default is BytesType, which is a straight forward lexical
comparison of the bytes in each column.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
- CompositeType (should be used with sub-types specified e.g. 'CompositeType(UTF8Type, Int32Type)'
quotes are important (!) in this case)
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- default_validation_class: Validator to use for values in columns which are
not listed in the column_metadata. Default is BytesType which applies
no validation.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
- CompositeType (should be used with sub-types specified e.g. 'CompositeType(UTF8Type, Int32Type)'
quotes are important (!) in this case)
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- key_validation_class: Validator to use for keys.
Default is BytesType which applies no validation.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- gc_grace: Time to wait in seconds before garbage collecting tombstone
deletion markers. Default value is 864000 or 10 days.
Set this to a large enough value that you are confident that the deletion
markers will be propagated to all replicas by the time this many seconds
has elapsed, even in the face of hardware failures.
See http://wiki.apache.org/Cassandra/DistributedDeletes
- read_repair_chance: Probability (0.0-1.0) with which to perform read
repairs for any read operation. Default is 0.1.
Note that disabling read repair entirely means that the dynamic snitch
will not have any latency information from all the replicas to recognize
when one is performing worse than usual.
- dclocal_read_repair_chance: Probability (0.0-1.0) with which to
perform read repairs against the node from the local data-center. If
this is lower than read_repair_chance, this will be ignored.
Example:
update column family Standard2
with read_repair_chance=0.1
and dclocal_read_repair_chance=0.5;
For 10 read queries, 1 will do read repair on all replicas (and
thus in particular on all replica of the local DC), 4 will only do
read repair on replica of the local DC and 5 will not do any read
repair.
- subcomparator: Validator to use to validate and compare sub column names
in this column family. Only applied to Super column families. Default is
BytesType, which is a straight forward lexical comparison of the bytes in
each column.
Supported values are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
- caching: Enable/Disable caching for the column family.
There is 2 kind of caches: key cache and row cache. A column family
can be set to use no cache, only one of them or both.
A key cache hit saves 1 seek while a row cache hit avoids disk
completely (saving at least 2 seeks). However the row cache holds
entire rows and is thus much more space-intensive. Also, since full
rows are stored, row cache should be used only for column families
whose rows are small.
Note: the global memory size of both cache can be set in the
configuration file (yaml) or through JMX (though it isn't persisted
across restarts in that latter case).
Supported values are:
- ALL (Enable row cache and key Cache)
- KEYS_ONLY
- ROWS_ONLY
- NONE;
- cells_per_row_to_cache: State the number of cells per row to cache.
Defaults to 100. Set to "ALL" if you want the old cache behaviour.
Will not be used if row caching is not enabled.
- speculative_retry: Speculative retry is used to speculate a read failure.
Speculative retry will execute additional read on a different nodes when
the read request doesn't complete within the x milliseconds.
Xpercentile will execute additional read requests to a different replicas
when read request was not completed within X percentile of the
normal/earlier recorded latencies.
Xms will execute additional read request to a diffrent replica when read
request was not completed in X milliseconds.
ALWAYS will execute data read request to 2 (If available) of the replicas
expecting a node to fail read.
Supported values are:
- ALWAYS
- Xpercentile
- Xms
- NONE;
- max_compaction_threshold: The maximum number of SSTables allowed before a
minor compaction is forced. Default is 32, setting to 0 disables minor
compactions.
Decreasing this will cause minor compactions to start more frequently and
be less intensive. The min_compaction_threshold and max_compaction_threshold
boundaries are the number of tables Cassandra attempts to merge together at
once.
- min_compaction_threshold: The minimum number of SSTables needed
to start a minor compaction. Default is 4, setting to 0 disables minor
compactions.
Increasing this will cause minor compactions to start less frequently and
be more intensive. The min_compaction_threshold and max_compaction_threshold
boundaries are the number of tables Cassandra attempts to merge together at
once.
- compression_options: Options related to compression.
Options have the form {key:value}.
The main recognized options are:
- sstable_compression: the algorithm to use to compress sstables for
this column family. If none is provided, compression will not be
enabled. Supported values are SnappyCompressor, DeflateCompressor or
any custom compressor. It is also valid to specify the fully-qualified
class name to a class that implements org.apache.cassandra.io.ICompressor.
- chunk_length_kb: specify the size of the chunk used by sstable
compression (default to 64, must be a power of 2).
To disable compression just set compression_options to null like this
`compression_options = null`.
Examples:
update column family Super4
with column_type = 'Super'
and caching='ALL';
update column family Standard3
and caching='ALL';
update column family Standard4
with column_metadata =
[{
column_name : Test,
validation_class : IntegerType,
index_type : 0,
index_name : IdxName},
{
column_name : 'other name',
validation_class : LongType
}];
- name: NODE_DEL_KEYSPACE
help: |
drop keyspace <keyspace>;
Drops the specified keyspace.
A snapshot of the data is created in a sub directory of the Keyspace data directory. The files
must be manually deleted using either "nodetool clearsnapshot" or the command line.
Required Parameters:
- keyspace: Name of the keyspace to delete.
Example:
drop keyspace Keyspace1;
- name: NODE_DEL_COLUMN_FAMILY
help: |
drop column family <cf>;
Drops the specified column family.
A snapshot of the data is created in a sub directory of the Keyspace data directory. The files
must be manually deleted using either "nodetool clearsnapshot" or the command line.
Required Parameters:
- cf: Name of the column family to delete.
Example:
drop column family Standard2;
- name: NODE_DROP_INDEX
help: |
drop index on <cf>.<column>;
Drops index on specified column of the column family.
Required Parameters:
- cf: Name of the column family.
- column: Name of the column to delete index on.
Example:
drop index on Users.name;
- name: NODE_THRIFT_GET
help: |
get <cf>['<key>'];
get <cf>['<key>']['<col>'] (as <type>)*;
get <cf>['<key>']['<super>']['<col>'] (as <type>)*;
get <cf>['<key>']['<super>'];
get <cf>['<key>'][<function>];
get <cf>[function(<key>)][<function>(<super>)][<function>(<col>)];
get <cf> where <col> <operator> <value> [
and <col> <operator> <value> and ...] [limit <limit>];
get <cf> where <col> <operator> <function>(<value>) [
and <col> <operator> <function> and ...] [limit <limit>];
Gets columns or super columns for the specified column family and key. Or
returns all columns from rows which meet the specified criteria when using
the 'where' form.
Note: The implementation of secondary indexes in Cassandra 0.7 has some
restrictions, see
http://www.datastax.com/dev/blog/whats-new-Cassandra-07-secondary-indexes
Required Parameters:
- cf: Name of the column family to read from.
Optional Parameters:
- col: Name of the column to read. Or in the 'where' form name of the column
to test the value of.
- function: Name of a function to call to parse the supplied argument to the
specified type. Some functions will generate values without needing an
argument.
Valid options are:
- ascii
- bytes: if used without arguments generates a zero length byte array
- int
- integer
- lexicaluuid: if used without arguments generates a new random uuid
- long
- timeuuid: if used without arguments generates a new time uuid
- utf8
- key: Key for the row to read columns from. This parameter is
required in all cases except when the 'where' clause is used.
- limit: Number of rows to return. Default is 100.
- operator: Operator to test the column value with. Supported operators are
=, >, >=, <, <= .
In Cassandra 0.7 at least one = operator must be present.
- super: Name of the super column to read from. If super is supplied without
col then all columns from the super column are returned.
- type: Data type to interpret the the columns value as for display.
Valid options are:
- AsciiType
- BooleanType
- BytesType
- CounterColumnType (distributed counter column)
- DateType
- DoubleType
- FloatType
- Int32Type
- IntegerType (a generic variable-length integer type)
- LexicalUUIDType
- LongType
- UTF8Type
- value: The value to test the column for, if a function is provided the
value is parsed by the function. Otherwise the meta data for the target
column is used to determine the correct type.
Examples:
get Standard1[ascii('testkey')];
#tell cli to convert keys from ascii to bytes
assume Standard1 keys as ascii;
get Standard1[testkey][test_column] as IntegerType;
get Standard1[testkey][utf8(hello)];
get Indexed1 where birthdate=19750403;
- name: NODE_THRIFT_SET
help: |
set <cf>['<key>']['<col>'] = <value>;
set <cf>['<key>']['<super>']['<col>'] = <value>;
set <cf>['<key>']['<col>'] = <function>(<argument>);
set <cf>['<key>']['<super>']['<col>'] = <function>(<argument>);
set <cf>[<key>][<function>(<col>)] = <value> || <function>;
set <cf>[<function>(<key>)][<function>(<col>) || <col>] =
<value> || <function> with ttl = <secs>;
Sets the column value for the specified column family and key.
Required Parameters:
- cf: Name of the column family to set columns in.
- col: Name of the column to set.
- key: Key for the row to set columns in.
Optional Parameters:
- function: Name of a function to call to parse the supplied argument to the
specified type. Some functions will generate values without needing an
argument.
Valid options are:
- ascii
- bytes: if used without arguments generates a zero length byte array
- int
- integer
- lexicaluuid: if used without arguments generates a new random uuid
- long
- timeuuid: if used without arguments generates a new time uuid
- utf8
- secs: Time To Live for the column in seconds. Defaults to no ttl.
- super: Name of the super column to contain the column.
- value: The value to set the column to.
Examples:
set Super1[ascii('testkey')][ascii('my super')][ascii('test col')]='this is a test';
set Standard1['testkey']['test col']='this is also a test';
set Standard1[testkey][testcol] = utf8('this is utf8 string.');
set Standard1[testkey][timeuuid()] = utf8('hello world');
set Standard1[testkey][timeuuid()] = utf8('hello world') with ttl = 30;
set UseComposites[utf8('testkey')]['CompositeType(utf8(first),int(4))'] = utf8('inserts this string into a column with name first:4');
- name: NODE_THRIFT_DEL
help: |
del <cf>['<key>'];
del <cf>['<key>']['<col>'];
del <cf>['<key>']['<super>'];
del <cf>['<key>']['<super>']['<col>'];
del <cf>[<function>(<key>)][<function>(<super>)][<function>(<col>)];
Deletes a row, a column, or a subcolumn.
Required Parameters:
- cf: Name of the column family to delete from.
- key: Key for the row delete from.
Optional Parameters:
- col: Name of the column to delete.
- function: Name of a function to call to parse the supplied argument to the
specified type. Some functions will generate values without needing an
argument.
Supported values are:
- ascii
- bytes: if used without arguments generates a zero length byte array
- int
- integer
- lexicaluuid: if used without arguments generates a new random uuid
- long
- double
- timeuuid: if used without arguments generates a new time uuid
- utf8
- super: Name of the super column to delete from. If col is not specified
the super column and all sub columns will be deleted.
Examples:
del Super1[ascii('testkey')][ascii('my_super')][ascii('test_col')];
del Standard1['testkey'][ascii('test col')];
del Standard1['testkey'];
del Standard1[utf8('testkey')];
- name: NODE_THRIFT_COUNT
help: |
count <cf>['<key>'];
count <cf>['<key>']['<super>'];
Count the number of columns in the row with the specified key, or
subcolumns in the specified super column.
Required Parameters:
- cf: Name of the column family to read from..
- key: Key for the row to count.
Optional Parameters:
- super: Name of the super column to count subcolumns in.
Examples:
count Super1['testkey']['my super'];
count Standard1['testkey'];
- name: NODE_LIST
help: |
list <cf>;
list <cf>[<startKey>:];
list <cf>[<startKey>:<endKey>];
list <cf>[<startKey>:<endKey>] limit <limit>;
list <cf>[<startKey>:<endKey>] ?(limit <limit>) ?(columns <col_limit> ?(reversed));
List a range of rows, and all of their columns, in the specified column
family.
The order of rows returned is dependant on the Partitioner in use.
Required Parameters:
- cf: Name of the column family to list rows from.
Optional Parameters:
- endKey: Key to end the range at. The end key will be included
in the result. Defaults to an empty byte array.
- limit: Number of rows to return. Default is 100.
- columns: Number of columns to return per row, Default to MAX_INTEGER. reversed -
columns in reverse order.
- startKey: Key start the range from. The start key will be
included in the result. Defaults to an empty byte array.
Examples:
list Standard1;
list Super1[j:];
list Standard1[j:k] limit 40;
list Standard1 columns 2;
list Standard1 limit 40 columns 0;
list Standard1 columns 3 reversed;
- name: NODE_TRUNCATE
help: |
truncate <cf>;
Truncate specified column family.
Note: All nodes in the cluster must be up to truncate command to execute.
A snapshot of the data is created, which is deleted asyncronously during a
'graveyard' compaction.
Required Parameters:
- cf: Name of the column family to truncate.
Examples:
truncate Standard1;
- name: NODE_ASSUME
help: |
assume <cf> comparator as <type>;
assume <cf> sub_comparator as <type>;
assume <cf> validator as <type>;
assume <cf> keys as <type>;
Assume one of the attributes (comparator, sub_comparator, validator or keys)
of the given column family match specified type. The specified type will
be used when displaying data returned from the column family.
This statement does not change the column family definition stored in
Cassandra. It only affects the cli and how it will transform values
to be sent to and interprets results from Cassandra.
If results from Cassandra do not validate according to the assumptions an
error is displayed in the cli.
Required Parameters:
- cf: Name of the column family to make the assumption about.
- type: Validator type to use when processing values.
Supported values are:
- ascii
- bytes
- counterColumn (distributed counter column)
- int
- integer (a generic variable-length integer type)
- lexicalUUID
- long
- utf8
It is also valid to specify the fully-qualified class name to a class that
extends org.apache.cassandra.db.marshal.AbstractType.
Examples:
assume Standard1 comparator as lexicaluuid;
assume Standard1 keys as ascii;
- name: NODE_THRIFT_INCR
help: |
incr <cf>['<key>']['<col>'] [by <value>];
incr <cf>['<key>']['<super>']['<col>'] [by <value>];
Increment the specified counter column by the supplied value.
Note: Counter columns must be defined using a 'create column family' or
'update column family' statement in the column_metadata as using the
ColumnCounterType validator.
Required Parameters:
- cf: Name of the column family to increment the column in.
- col: Name of the counter column to increment.
- key: Key for the row to increment the counter in.
Optional Parameters:
- super: Name of the super column that contains the counter column.
- value: Signed integer value to increment the column by. If not supplied
1 is used.
Examples:
incr Counter1[ascii('testkey')][ascii('test col')];
incr SuperCounter1[ascii('testkey')][ascii('my super')][ascii('test col')] by 42;
incr Counter1[ascii('testkey')][ascii('test col')] by -4;
- name: NODE_THRIFT_DECR
help: |
decr <cf>['<key>']['<col>'] [by <value>];
decr <cf>['<key>']['<super>']['<col>'] [by <value>];
Decrement the specified column by the supplied value.
Note: Counter columns must be defined using a 'create column family' or
'update column family' statement in the column_metadata as using the
ColumnCounterType validator.
Required Parameters:
- cf: Name of the column family to decrement the column in.
- col: Name of the counter column to increment.
- key: Key for the row to decrement the counter in.
Optional Parameters:
- super: Name of the super column that contains the counter column.
- value: Signed integer value to decrement the column by. If not supplied
1 is used.
Examples:
decr Counter1[ascii('testkey')][ascii('test col')];
decr SuperCounter1[ascii('testkey')][ascii('my super')][ascii('test col')] by 42;
decr Counter1[ascii('testkey')][ascii('test col')] by 10;
- name: NODE_CONSISTENCY_LEVEL
help: |
consistencylevel as <level>
Sets the consistency level for the client to use. Defaults to One.
Required Parameters:
- level: Consistency level the client should use. Value is case
insensitive.
Supported values are:
- ONE
- TWO
- THREE
- QUORUM
- ALL
- LOCAL_QUORUM
- EACH_QUORUM
- ANY
Note: Consistency level ANY can only be used for write operations.