Bitnami Apache Cassandra for Microsoft Azure

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 /opt/bitnami/cassandra/conf/cassandra.yaml file and replace the following lines:

       authenticator: PasswordAuthenticator
       authorizer: CassandraAuthorizer
    

    with:

       authenticator: AllowAllAuthenticator
       authorizer: AllowAllAuthorizer
    
  • Restart your database:

       $ sudo /opt/bitnami/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 /opt/bitnami/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?

For security reasons, the Cassandra ports in this solution cannot be accessed over a public IP address. To connect to Cassandra from a different machine, you must open ports 9042, 9160, 7000, 7001 and 7199 for remote access. Refer to the FAQ for more information on this.

IMPORTANT: Making this application's network ports public is a significant security risk. You are strongly advised to only allow access to those ports from trusted networks. If, for development purposes, you need to access from outside of a trusted network, please do not allow access to those ports via a public IP address. Instead, use a secure channel such as a VPN or an SSH tunnel. Follow these instructions to remotely connect safely and reliably.

You can then access Cassandra using a command like the one below:

$ cqlsh -u cassandra SERVER-IP

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 /opt/bitnami/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 /opt/bitnami/cassandra/log/system.log.

azure

Bitnami Documentation