Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

Superfluxus avatar image
Superfluxus asked ·

Attempts to add an existing cluster to OpsCenter returns "Error when attempting to create OpsCenter schema: (AlterSchemaFailed)"

Hello!

I am aware that this is potentially a duplicate of https://community.datastax.com/questions/4118/clustering-key-columns-must-exactly-match-columns.html but that thread didn't solve my issue.

I am following this guide https://docs.datastax.com/en/docker/doc/docker/docker68/dockerOpscenter.html to create an OpsCenter container in Docker. I have run these two docker commands:

docker run -e DS_LICENSE=accept -p 8888:8888 --name my-opscenter -d datastax/dse-opscenter 

docker run -e DS_LICENSE=accept --link my-opscenter:opscenter --name my-dse -d datastax/dse-server:6.8.7

I have then logged onto the container through localhost:8888, clicked 'Manage Cluster', gave the GUI the correct IP of the container, and it errors out after about 40 seconds with "OpsCenter was not able to add the cluster: Shutting down services for cluster 'Test_Cluster' after failed schema creation ".

Looking at the logs of the Docker Container itself, I see that this SQL Statement:

CREATE TABLE if not exists "OpsCenter"."backup_reports" ( week text, event_time timestamp, backup_id text, type text, destination text, deleted_at timestamp, keyspaces text, status text, full_status text, PRIMARY KEY ((week), event_time, backup_id, type, destination) ) WITH comment='{"version": [6, 7, 4], "info": "OpsCenter management data."}' AND CLUSTERING ORDER BY (event_time DESC)

fails with this traceback

failed to completed because: com.datastax.driver.core.exceptions.InvalidQueryException: Clustering key columns must exactly match columns in CLUSTERING ORDER BY directive. (MainThread) 2020-12-01 10:52:28,832 [Test_Cluster] INFO: Sleeping for 10s before retrying schema creation (MainThread) 2020-12-01 10:52:38,839 [Test_Cluster] ERROR: Error when attempting to create OpsCenter schema: (AlterSchemaFailed) Traceback (most recent call last): File "/opt/opscenter/lib/py/twisted/internet/defer.py",line 1122, in _inlineCallbacks result = result.throwExceptionIntoGenerator(g) File "/opt/opscenter/lib/py/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator return g.throw(self.type, self.value, self.tb) File "/usr/share/opscenter/Lib/site-packages/opscenterd/WrappedDriver.py", line 200, in execute_schema_change AlterSchemaFailed: Failure applying schema change

It retries about 3 times before ultimately failing. I am unsure how I can manually change the key columns, as I'm not manually passing any SQL queries through, I'm just running the wizard through the GUI. I have tried this with several images at https://hub.docker.com/r/datastax/dse-server/tags?page=1&ordering=last_updated from 6.8.7 down to 6.0.14, and they all give me the same error message.

If anyone has any advice how can I get this GUI to work and create a local OpsCentre container as set out in the guide I'm following, I would be very grateful. Thankyou

opscenter
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

I've seen reports of this issue in the past although I haven't been able to work out why it happens.

My suspicion is that your DSE cluster already has an OpsCenter keyspace from an older version of an OpsCenter installation so the current OpsCenter you're using is having issues modifying the schema for that keyspace.

As a workaround, I would suggest you login to your cluster and drop the OpsCenter keyspace completely:

cqlsh> DROP KEYSPACE 'OpsCenter';

Then attempt to add the cluster again in the OpsCenter UI. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hi Erick, thankyou for your reply. It seems there's a strict 1000 character limit on the reply function here, so please excuse my curtness.

I did as you suggested and manually dropped the keyspace before trying again. I saw the UI successfully recreate the keyspace and the bestpractices_results table, before erroring out on creating the backup_reports table again with the same error message.

Clustering key columns must exactly match columns in CLUSTERING ORDER BY directive


I've attempted to get this DSE container running on 3 seperate VMs at this stage, so I don't believe that older Cassandra/DSE installations could be causing conflict issues.

If you know of any other ideas, or even manual SQL queries I could run to try and create this table ad-hoc to get further, I'm all ears

Best regards

0 Likes 0 · ·

It's difficult to work out what's going on without looking at your configuration and the logs. Please log a ticket with DataStax Support so one of our engineers can request the required diagnostic info to assist you. Cheers!

0 Likes 0 · ·