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.
- Install DBeaver community edition with brew:
brew cask install dbeaver-community
- Download the cassandra jdbc driver.
- When first launching DBeaver, cancel setting up a connection, and say ‘No’ to creating a sample database
- From the ‘Database’ menu choose ‘Driver Manager’
- In the modal dialog click the ‘New’ button
- In the ‘Driver Name’ field, enter ‘Cassandra’
- In the ‘Class Name’ field, enter ‘com.github.cassandra.jdbc.CassandraDriver’
- In the ‘URL Template’ field, enter ‘jdbc:c*:datastax://{host}[:{port}]/{database}’
- Click the ‘Add File’ button, and choose the ‘cassandra-jdbc-driver-0.6.4-shaded.jar’ downloaded previously
- Click ‘OK’ to save the Cassandra driver, and then ‘Close’ to close the ‘Driver Manager’
- From the ‘Database’ menu, pick ‘New Connection’
- Select ‘Cassandra’ from the list of database drivers and click ‘Next’
- 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’
- Click ‘Next’ again to skip the Network config step, and then ‘Finish’ to save the connection.
At this point it should work.