April 18, 2024
Get the new Cassandra driver for Liquibase 4.25.0+ | Cassandra versioning support with Liquibase
See Liquibase in Action
Accelerate database changes, reduce failures, and enforce governance across your pipelines.
Liquibase is excited to announce we’ve implemented a new Apache Cassandra driver in Liquibase version 4.25.0 and beyond. This new driver will be used for Cassandra support going forward, providing a more easily accessible option to our users.
The Liquibase Community team has changed the supported driver from the DataStax Simba driver to the ING Cassandra driver. More information about the new driver can be found on its cassandra-jdbc-wrapper repository page.
Here’s why we made this change – and how Cassandra-Liquibase users can install, configure, and test the new driver for optimal database change management automation on the updated platform.
Why change the Liquibase Cassandra driver?
Previously, the Liquibase Cassandra extension was configured to work with DataStax’s Simba driver. However, the driver has been harder to obtain as it is no longer publicly hosted, so the Liquibase Community team got to work changing the driver to one that everyone can access.
How to update your Cassandra driver for Liquibase
Let’s walk through what’s required to make this driver change and highlight the main differences introduced. Follow these steps to deploy your changesets with Liquibase to your Cassandra database using the new ING driver.
To get started, you need to have a running Apache Cassandra database and Liquibase v4.25+ installed.
Step 1: Install the Cassandra driver locally
The first thing you will want to do is install the new driver, which can be found here. The driver is a jar file and will have the name cassandra-jdbc-wrapper-<version>-bundle.jar
. We recommend installing the latest version, which at the time of writing is v4.11.1.
Once you have installed the jar file, you should place it in the Liquibase home directory lib folder.
Step 2: Install the Liquibase Cassandra Extension
Next, you will want to install the Liquibase Cassandra extension, which can be found here. The extension name is the following format: liquibase-cassandra-<version>.jar
. You should ensure that you download the extension that is the same version as your main installation for Liquibase. For example, if you have Liquibase v4.26.0 installed, you will need to install the liquibase-cassandra-4.26.0.jar
file.
Like the driver file, you should place the extension jar in the same lib directory referenced in step 1.
Step 3: Configure the Liquibase project
Now that you have the new driver and the Cassandra extension, you can configure the Liquibase project. For simplicity, we’ll walk through how to configure the liquibase.properties file, an example of which is shown below:
changeLogFile: mainChangelog.xml
url: jdbc:cassandra://<host>:<port>/<keyspace>?localdatacenter=<datacenter>&compliancemode=Liquibase
driver: com.ing.data.cassandra.jdbc.CassandraDriver
username: <username>password: <password>
Some attributes, such as changelog, username, and password, will remain the same as they were previously configured. The driver attribute will be set to com.ing.data.cassandra.jdbc.CassandraDriver.
The noticeable difference is in the JDBC URL, which contains two new required attributes that are specific to the ING driver, compliencemode and localdatacetner.
Compliancemode
: The team working on the ING driver added this attribute, which specifies that Liquibase is using the driver and gives additional requirements Liquibase needs to connect to the database. This will always be set to the valueLiquibase
.Localdatacetner
: This value will vary depending on your Cassandra database. If you don’t know what yourlocaldatacenter
is called, you can easily find this out by using thenodetool status
command (automatically installed on Cassandra servers). You will need to access your server via a CLI and runnodetool status
, which will give thelocaldatacenter
name. If you are unsure how to obtain this information, please contact your Cassandra DBA.
Step 4: Test it out
Congratulations – you’ve configured Liquibase and the Liquibase project to use the new ING driver for Cassandra. The final step is test it out.
Open up a CLI in your Lliquibase project directory and run liquibase status
to verify the connection. Once the connection can be made, you can deploy your changesets to a Cassandra database using the new driver.
Example Liquibase Projects using the ING driver
In the repository Cassandra-ING-Demo, there are a couple of different examples of Liquibase projects using the ING driver. The repo consists of the CLI example, Liquibase-maven plugin, and building a jar file via Maven.
If you run into any problems connecting Liquibase or setting up the new Cassandra driver, you can connect with our Liquibase Community resources, such as our Liquibase Forum, our Liquibase Discord Chat, or if it is a bug, submit a Github issue on the liquibase-cassandra issue board.