Bitnami Apache Cassandra

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.

Apache Cassandra is a distributed database system designed for high availability. It can support thousands of concurrent operations per second.

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 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 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 find the database credentials?

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.

NOTE: When running the commands shown on this page, replace the installdir placeholder with the full installation directory for your Bitnami stack.
nativeInstaller

Bitnami Documentation