Applies to:
- Liquibase Pro
- Liquibase Open Source (Community)
Summary:
Apache Cassandra is a community-maintained integration of Liquibase and is currently at the Contributed level for Database Verification & Support. CData has a closed-source Cassandra driver that can be used to create a JDBC connection to a Cassandra database that Liquibase can use. However, some configuration steps are required to use this driver with Liquibase.
Environment Conditions:
- Any recent version of Liquibase and corresponding liquibase-cassandra extension
- Currently tested with CData JDBC Driver For Cassandra 2023 23.0.8565.0 By CData Software, Inc.
How to configure Liquibase to work with the CData Cassandra driver
- Download the liquibase-cassandra extension from the Liquibase release matching your version and place the liquibase-cassandra-.jar file into the Liquibase /lib folder.
- Download the JDBC CData Cassandra driver.
- Note: You will need either a purchased CData license or a trial license to be able to utilize the driver
- Move the cdata.jdbc.cassandra.jar file (path is CassandraJDBCDriver lib cdata.jdbc.cassandra.jar) to the Liquibase /lib folder.
- Move your CData license to either the Liquibase /lib folder or the ~/.CData/lib folder.
- If you don't have a purchased license, you can use a trial license.
- To activate your trial license, run the below command in the same directory as the cdata.jdbc.cassandra.jar, which will generate a license file after answering a few questions.
java -jar cdata.jdbc.cassandra.jar --license
- In the liquibase.properties file (you can also use the CLI or Liquibase environment variables), add the following properties:
-
url: jdbc:cassandra://:/
driver: cdata.jdbc.cassandra.CassandraDriver
liquibase.command.defaultSchemaName:
-
- Note: When using the CData driver, Liquibase cannot create the DATABASECHANGELOG and DATABASECHANGELOGLOCK table. These two tables must be created manually for each keyspace Liquibase connects to.
- Create the DATABASECHANGELOGLOCK table.
-
CREATE TABLE IF NOT EXISTS ."DATABASECHANGELOGLOCK" (
"ID" INT,
"LOCKED" BOOLEAN,
"LOCKGRANTED" timestamp,
"LOCKEDBY" TEXT,
PRIMARY KEY ("ID")
);
-
- Create the DATABASECHANGELOG table.
-
CREATE TABLE IF NOT EXISTS ."DATABASECHANGELOG" (
"ID" TEXT,
"AUTHOR" TEXT,
"FILENAME" TEXT,
"DATEEXECUTED" timestamp,
"ORDEREXECUTED" INT,
"EXECTYPE" TEXT,
"MD5SUM" TEXT,
"DESCRIPTION" TEXT,
"COMMENTS" TEXT,
"TAG" TEXT,
"LIQUIBASE" TEXT,
"CONTEXTS" TEXT,
"LABELS" TEXT,
"DEPLOYMENT_ID" TEXT,
PRIMARY KEY ("ID", "AUTHOR", "FILENAME")
);
-
- Run liquibase status to verify connectivity.
Comments
0 comments
Article is closed for comments.