Bitnami Cassandra Installer

NOTE: Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and Mac OS X) or by clicking the shortcut in the Start Menu under "Start -> Bitnami APPNAME Stack -> Application console" (Windows). Learn more.
NOTE: When running the commands shown on this page, replace the installdir placeholder with the full installation directory for your Bitnami stack.

Description

Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many servers, providing high availability with no single point of failure.

First steps with the Bitnami Cassandra Stack

Welcome to your new Bitnami application! Here are a few questions (and answers!) you might need when first starting with your application.

What are the system requirements?

Before you download and install your application, check that your system meets these requirements.

How do I install the Bitnami Cassandra Stack?

Windows, OS X and Linux installer
  • Download the executable file for the Bitnami Cassandra Stack from the Bitnami website.

  • Run the downloaded file:

    • On Linux, give the installer executable permissions and run the installation file in the console.
    • On other platforms, double-click the installer and follow the instructions shown.

Check the FAQ instructions on how to download and install a Bitnami Stack for more details.

The application will be installed to the following default directories:

Operating System Directory
Windows C:\Bitnami\APPNAME-VERSION
Mac OS X /Applications/APPNAME-VERSION
Linux /opt/APPNAME-VERSION (running as root user)
OS X VM
  • Download the OS X VM file for the Bitnami Cassandra Stack from the Bitnami website.
  • Begin the installation process by double-clicking the image file and dragging the WordPress OS X VM icon to the Applications folder.
  • Launch the VM by double-clicking the icon in the Applications folder.

What credentials do I need?

You need application credentials, consisting of a username and password. These credentials allow you to log in to your new Bitnami application.

What is the administrator username set for me to log in to the application for the first time?

  • For Windows, Linux and OS X installers, the username was configured by you when you first installed the application.
  • For OS X VMs, the username can be obtained by clicking the Bitnami badge at the bottom right corner of the application welcome page.

What is the administrator password?

  • For Windows, Linux and OS X installers, the password was configured by you when you first installed the application.
  • For OS X VMs, the password can be obtained by clicking the Bitnami badge at the bottom right corner of the application welcome page.

How to start or stop the services?

Linux

Bitnami native installers include a graphical tool to manage services. This tool is named manager-linux-x64.run on Linux and is located in the installation directory. To use this tool, double-click the file and then use the graphical interface to start, stop or restart services. Server log messages can be checked in the "Server Events" tab.

Management tool

The native installer also includes a command-line script to start, stop and restart applications, named ctlscript.sh. This script can be found in the installation directory and accepts the options start, stop, restart, and status. To use it, log in to the server console and execute it following the examples below:

  • Call it without any service names to start all services:

      $ sudo installdir/ctlscript.sh start
    
  • Use it to restart a specific service only by passing the service name as argument - for example, mysql, postgresql or apache:

      $ sudo installdir/ctlscript.sh restart mysql
      $ sudo installdir/ctlscript.sh restart postgresql
      $ sudo installdir/ctlscript.sh restart apache
    
  • Obtain current status of all services:

      $ installdir/ctlscript.sh status
    

The list of available services varies depending on the required components for each application.

Mac OS X

Bitnami native installers include a graphical tool to manage services. This tool is named manager-osx on Mac OS X and is located in the installation directory. To use this tool, double-click the file and then use the graphical interface to start, stop or restart services. Server log messages can be checked in the "Server Events" tab.

Management tool

The native installer also includes a command-line script to start, stop and restart applications, named ctlscript.sh. This script can be found in the installation directory and accepts the options start, stop, restart, and status. To use it, log in to the server console and execute it following the examples below:

  • Call it without any service names to start all services:

    $ sudo installdir/ctlscript.sh start
    
  • Use it to restart a specific service only by passing the service name as argument - for example, mysql or apache:

     $ sudo installdir/ctlscript.sh restart mysql
     $ sudo installdir/ctlscript.sh restart apache
    
  • Obtain current status of all services:

     $ installdir/ctlscript.sh status
    

The list of available services varies depending on the required components for each application.

NOTE: If you are using the stack manager for Mac OS X-VM, please check the following blog post to learn how to manage services from its graphical tool.

Windows

Bitnami native installers include a graphical tool to manage services. This tool is named manager-windows.exe on Windows and is located in the installation directory. To use this tool, double-click the file and then use the graphical interface to start, stop or restart services. Server log messages can be checked in the "Server Events" tab.

Management tool

The Windows native installer creates shortcuts to start and stop services created in the Start Menu, under "Programs -> Bitnami APPNAME Stack -> Bitnami Service". Servers can also be managed from the Windows "Services" control panel. Services are named using the format APPNAMESERVICENAME, where APPNAME is a placeholder for the application name and SERVICENAME is a placeholder for the service name. For example, the native installer for the Bitnami WordPress Stack installs services named wordpressApache and wordpressMySQL.

These services will be automatically started during boot. To modify this behaviour, refer to the section on disabling services on Windows.

What is the default configuration?

The Cassandra admin user for all databases is automatically generated. The administrator user name is cassandra and you can get the password from the server dashboard for your server.

You can connect to the Cassandra server locally or remotely using the cqlsh command line tool:

$ cqlsh -u cassandra
Password:
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.1 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.

The Cassandra server is configured to accept incoming connections on the default Cassandra client port 9042. This could be a security issue so it is strongly advisable to close this port or open it only for a specific IP address. Other ports for configuring nodes are closed by default in the firewall.

Cassandra configuration file

The Cassandra configuration file is located at installdir/cassandra/conf/cassandra.yaml.

Cassandra ports

  • Cassandra client: 9042
  • Cassandra client thrift port: 9160
  • Cassandra transport port: 7000
  • Cassandra transport secure port: 7001
  • Cassandra jmx port: 7199

Cassandra log file

The Cassandra log file is created at installdir/cassandra/log/system.log.

How to find the database credentials?

How to connect to the Cassandra server?

You can connect to Cassandra from the same server. Obtain the password from the dashboard for your server.

$ cqlsh -u cassandra

This will connect you to the Cassandra console and display a prompt. Once connected, you can run cqlsh commands to create and populate data. For example, the command below lists available keyspaces:

cassandra@cqlsh> describe keyspaces
system_traces  system_schema  system_auth  system  system_distributed

You can learn more about Cassandra in the Cassandra Getting Started guide.

How to connect to Cassandra from a different machine?

IMPORTANT: Bitnami Native Installers do not modify the firewall configuration of your computer, therefore the Cassandra ports could be open which is a significant security risk. You are strongly advised to close the Cassandra ports (refer to the FAQ for more information on this).

Once you have an active SSH tunnel or if you did not close the port for remote access, you can then connect to Cassandra using a command like the one below.

$ cqlsh -u cassandra localhost

How to check the Cassandra server version?

Use the commands below:

$ cqlsh -u cassandra
Password:
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.1 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.

cassandra@cqlsh> show version
[cqlsh 5.0.1 | Cassandra 2.1.1 | CQL spec 3.2.0 | Native protocol v3]

How to change the Cassandra administrator password?

You can modify the Cassandra password using the following command at the shell prompt:

$ cqlsh -u cassandra -p PASSWORD
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.

cqlsh> ALTER USER cassandra with PASSWORD 'NEWPASSWORD';
cqlsh> exit

How to reset the Cassandra administrator password?

You can reset the administrator password by following the steps below:

  • Edit the installdir/cassandra/conf/cassandra.yaml file and replace the following lines:

       authenticator: PasswordAuthenticator
       authorizer: CassandraAuthorizer
    

    with:

       authenticator: AllowAllAuthenticator
       authorizer: AllowAllAuthorizer
    
  • Restart your database:

       $ sudo installdir/ctlscript.sh restart cassandra
    
  • Execute the following commands:

       $ cqlsh
       Connected to Test Cluster at 127.0.0.1:9042.
       [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
       Use HELP for help.
          
       cqlsh> UPDATE system_auth.roles SET salted_hash = '$2a$10$1gMPBy9zSkDzKxdbU2v/gOslcMRPDcXVqmwQYBmi8MVgYvNdRZw/.' WHERE role = 'cassandra';
       cqlsh> exit
    
  • Undo the changes made in installdir/cassandra/conf/cassandra.yaml and restart Cassandra again. Now you can access your database using the user name cassandra and password cassandra:

         $ cqlsh -u cassandra -p cassandra
         Connected to Test Cluster at 127.0.0.1:9042.
         [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
         Use HELP for help.
         cqlsh>
    

Once you have access, don't forget to change the cassandra user account password to something else as described in the previous section. This is the default password and it's unsecure.

How to create a Cassandra cluster?

Create a Cluster with a Single Seed Node

  • Launch the Bitnami Cassandra Stack on each node.

  • Log in to each node and stop the Cassandra service.

     $ sudo installdir/ctlscript.sh stop cassandra
    
  • Get the public and private IP address of each node in the cluster.

  • Select one of the nodes as the seed node for the cluster. In this guide, assume that the seed node has public IP address 130.1.1.1 and private IP address 10.1.1.1.

  • Open the Cassandra transport port (tcp:7000 by default) in your server firewall. Then, restart your Cassandra servers.

  • On each node in the cluster, modify the installdir/cassandra/conf/cassandra.yaml file and update the following directives:

    • -seeds: Use the public IP address of the seed node.

    • listen_address: Use the current node's private IP address.

    • broadcast_address: Use the current node's public IP address.

    • endpoint_snitch: Select the correct snitch for your environment based on the official documentation.

    For example, on the seed node, your configuration file might look like this:

       cluster_name: 'MyCassandraCluster'
       num_tokens: 256
       seed_provider:
         - class_name: org.apache.cassandra.locator.SimpleSeedProvider
           parameters:
                - seeds: "130.1.1.1"
       broadcast_address: 130.1.1.1
       listen_address: 10.1.1.1
       endpoint_snitch: GossipingPropertyFileSnitch
    

    Repeat the above configuration for all the nodes in the cluster. Remember that you must modify the listen_address and broadcast_address on each node to reflect the node's IP addresses.

  • For all nodes apart from the seed node, delete the default data. This is necessary to avoid collisions between the system tables on different nodes.

     $ sudo rm -rf installdir/cassandra/data/*
    
  • Start Cassandra on the seed node, followed by the other nodes, to have the changes take effect:

     $ sudo installdir/ctlscript.sh start cassandra
    

Your cluster should now be operational with a single seed node. To verify, execute the command below on any node in the cluster:

$ installdir/cassandra/bin/nodetool status

You can connect to any server of the cluster using the credentials for the first seed node.

You can also watch the Cassandra log file at installdir/cassandra/log/system.log to check that the cluster nodes recognize and can communicate with each other.

Create a Cluster with Multiple Seed Nodes

IMPORTANT: Before creating a cluster with multiple seed nodes, ensure that you have a working cluster with a single seed node as described in the previous section. Then, repeat the steps below for each new seed node that you wish to add to the cluster.
  • Launch the Bitnami Cassandra Stack on a new node. This will be the new seed node for your cluster.

  • Log in to each node and stop the Cassandra service.

       $ sudo installdir/ctlscript.sh stop cassandra
    
  • Get the public and private IP address of the new seed node. In this guide, assume that the new seed node has public IP address 140.1.1.1 and private IP address 20.1.1.1.

  • On the new node, edit the configuration file installdir/cassandra/conf/cassandra.yaml and specify it as a seed node by adding its public IP address to the seeds list. Also specify the other configuration parameters, such as the listen_address and the broadcast_address, as described in the previous section. Here is what the configuration file would look like:

       cluster_name: 'MyCassandraCluster'
       num_tokens: 256
       seed_provider:
         - class_name: org.apache.cassandra.locator.SimpleSeedProvider
           parameters:
                - seeds: "130.1.1.1, 140.1.1.1"
       broadcast_address: 140.1.1.1
       listen_address: 20.1.1.1
       endpoint_snitch: GossipingPropertyFileSnitch
    
  • Delete the default data. This is necessary to avoid collisions between the system tables on different nodes.

       $ sudo rm -rf installdir/cassandra/data/*
    
  • On each of the other nodes in the cluster, update the installdir/cassandra/conf/cassandra.yaml file and add the public IP address of the new seed node to the seeds list.

  • Restart Cassandra on the seed nodes, followed by the non-seed nodes.

       $ sudo installdir/ctlscript.sh start cassandra
    

Your cluster should now be operational with the new seed node. To verify, execute the command below on any node in the cluster:

$ installdir/cassandra/bin/nodetool status

You can connect to any server of the cluster using the credentials for the first seed node.

You can also watch the Cassandra log file at installdir/cassandra/log/system.log to check that the cluster nodes recognize and can communicate with each other.

How can I run a command in the Bitnami Cassandra Stack?

Load the Bitnami Console and then run the command as usual.

How to create a full backup of Cassandra?

The Bitnami Cassandra Stack is self-contained and the simplest option for performing a backup is to copy or compress the Bitnami stack installation directory. To do so in a safe manner, you will need to stop all servers, so this method may not be appropriate if you have people accessing the application continuously.

NOTE: If you want to create only a database backup, refer to these instructions for MySQL and PostgreSQL.

Backup on Linux and Mac OS X

Follow these steps:

  • Change to the directory in which you wish to save your backup.

     $ cd /your/directory
    
  • Stop all servers.

     $ sudo installdir/ctlscript.sh stop
    
  • Create a compressed file with the stack contents.

     $ sudo tar -pczvf application-backup.tar.gz installdir
    
  • Start all servers.

     $ sudo installdir/ctlscript.sh start
    
  • Download or transfer the application-backup.tar.gz file to a safe location.

You should now download or transfer the application-backup.tar.gz file to a safe location.

Backup on Windows

Follow these steps:

  • Stop all servers using the shortcuts in the Start Menu or the graphical manager tool.

  • Create a compressed file with the stack contents. You can use a graphical tool like 7-Zip or WinZip or just right-click the folder, click "Send to", and select the "Compressed (zipped) folder" option.

  • Download or transfer the compressed file to a safe location.

  • Start all servers using the shortcuts in the Start Menu or the graphical manager tool.

Restore on Linux and Mac OS X

Follow these steps:

  • Change to the directory containing your backup:

    $ cd /your/directory
    
  • Stop all servers.

    $ sudo installdir/ctlscript.sh stop
    
  • Move the current stack to a different location:

    $ sudo mv installdir /tmp/bitnami-backup
    
  • Uncompress the backup file to the original directory:

    $ sudo tar -pxzvf application-backup.tar.gz -C /
    
  • Start all servers.

    $ sudo installdir/ctlscript.sh start
    
IMPORTANT: When restoring, remember to maintain the original permissions for the files and folders. For example, if you originally installed the stack as the root user on Linux, make sure that the restored files are owned by root as well.

Restore on Windows

  • Change to the directory containing your backup:

       $ cd /your/directory
    
  • Stop all servers using the shortcuts in the Start Menu or the graphical manager tool.

  • Uninstall the previous services by executing the following command:

        $ serviceinstall.bat
    
  • Create a safe folder named Backups in the desktop and move the current stack to it. Remember to replace PATH with the right location of your folder:

        $ move installdir \PATH\Backups
    
  • Uncompress the backup file using a tool like 7-Zip or Winzip or just double-click the .zip file to uncompress it, and move it to the original directory.
  • Install services by running the following commands from an elevated command prompt:

      $ cd installdir
      $ serviceinstall.bat INSTALL
    
  • Start all servers using the shortcuts in the Start Menu or the graphical manager tool.
nativeInstaller

Bitnami Documentation