Cassandra on MacOS

These are my notes on getting Cassandra going on macOS. Took me a while to figure it all out, so I’m documenting them here for when I need to do it again.

These notes are correct as of November 4, 2017, but I expect that they will go stale before to long. At this moment in time: brew cask install java installs Java 9, and brew install cassandra installs Cassandra 3.11.1. But Cassandra 3.11.1 does not work with Java 9, it requires Java 8. The only option at the moment appears to downgrade to Java 8. To do this:

brew update
brew tap caskroom/versions
brew cask uninstall java
brew cask install java8
brew install cassandra
brew services start cassandra

With Cassandra installed, my next task was to get a GUI for Cassandra so I could easily look at what my CQL was doing. DBeaver seems most highly recommended, but the Community edition no longer supports Cassandra out of the box, and the Enterprise edition is no longer free.

To get around this I needed to install the community edition, and then add an open source Cassandra driver manually. Getting DBeaver installed was easy with brew. Thankfully Zhichun Wu has a good Cassandra jdbc driver available on GitHub. Setting it up in DBeaver took a little trial and error. Just follow the steps below to get it all going.

  1. Install DBeaver community edition with brew:
    brew cask install dbeaver-community
  2. Download the cassandra jdbc driver.
  3. When first launching DBeaver, cancel setting up a connection, and say ‘No’ to creating a sample database
  4. From the ‘Database’ menu choose ‘Driver Manager’
  5. In the modal dialog click the ‘New’ button
  6. In the ‘Driver Name’ field, enter ‘Cassandra’
  7. In the ‘Class Name’ field, enter ‘com.github.cassandra.jdbc.CassandraDriver’
  8. In the ‘URL Template’ field, enter ‘jdbc:c*:datastax://{host}[:{port}]/{database}’
  9. Click the ‘Add File’ button, and choose the ‘cassandra-jdbc-driver-0.6.4-shaded.jar’ downloaded previously
  10. Click ‘OK’ to save the Cassandra driver, and then ‘Close’ to close the ‘Driver Manager’
  11. From the ‘Database’ menu, pick ‘New Connection’
  12. Select ‘Cassandra’ from the list of database drivers and click ‘Next’
  13. Enter ‘localhost’ for the Host, ‘9042’ for the Port, ‘system’ for the Database/Schema, ‘cassandra’ for the User name, and ‘cassandra’ for the Password, then click ‘Next’
  14. Click ‘Next’ again to skip the Network config step, and then ‘Finish’ to save the connection.

At this point it should work.

Leave a Reply