Database Reference
In-Depth Information
Anatomy of the installation
There are a couple of programs and files that one must know about to work effectively with
Cassandra. These programs and files come to use during investigation, maintenance, con-
figuration, and optimization.
Depending on how the installation is done, the file may be available at different locations.
For a tarball installation, everything is neatly packaged under the directory where Cas-
sandra is installed: binaries under the
bin
directory and the configuration file under the
conf
directory. For repository-based installations, binaries are available in
/usr/bin
and
/usr/sbin
directories and configuration files are available under
/etc/cas-
sandra
and
/etc/default/cassandra
.
Cassandra binaries
Cassandra binaries contain executables for various tasks. These executables exist in the in-
stallation directory under the
bin/
folder or
tools/bin/
. Let's take a quick glance at
them:
•
bin/cassandra
: It starts the Cassandra daemon using the default configuration.
To start Cassandra in the foreground, use the
-f
option. You can use
Ctrl
+
C
to
kill Cassandra and view logs on the console. One may also use
-p <pid_file>
to have a handle and kill Cassandra running in the background by using
kill
`cat <pid_file>`
.
If Cassandra is installed from the repository, it must have created a service for it.
Therefore, one should use
sudo service cassandra start
,
sudo ser-
vice cassandra stop
, and
sudo service cassandra status
to
start, stop, and query the status of Cassandra, respectively.
•
bin/cassandra-cli
: Cassandra's
command-line interface
(
CLI
) gives very
basic access to execute simple commands meant for modifying and accessing key-
spaces and column families. The typical use of Cassandra looks like this:
cassandra-cli -h <hostname> -p <port> -k <keyspace>
A file of statements can be passed to the CLI using the
-f
option.
•
bin/cqlsh
: This is a CLI to execute CQL3 queries. Typically, the
cqlsh-
connect
command looks like this: