3
votes

Cassandra gives me serious headache. Yesterday, everything was running fine and then I dropped a table, ran a CQLSSTableWriter which somehow threw errors about my Lucene index (for not being on classpath or the like) several times and now, every command I issue in the cqlsh is throwing errors.

CREATE KEYSPACE IF NOT EXISTS mydata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};

takes a while and then throws:

Warning: schema version mismatch detected, which might be caused by DOWN nodes; 
if this is not the case, check the schema versions of your nodes in system.local and system.peers. 
OperationTimedOut: errors={}, last_host=XXX.XXX.XXX.20

After that I will create a new table and it will also throw the same error.

cqlsh:mydata> create table test (id text PRIMARY KEY, id2 text);
Warning: schema version mismatch detected, which might be caused by DOWN nodes; if this is not the case, check the schema versions of your nodes in system.local and system.peers.
OperationTimedOut: errors={}, last_host=XXX.XXX.XXX.20

last_host always shows the ip of the host where I run the cqlsh on. I have tried the same commands with different nodes too.

The keyspace and table however is still being created! The error says something about mismatching schema versions, so I made sure and ran:

nodetool describecluster

And the output of it shows that all my nodes are on the same schema. No schema mismatches. I also issued nodetool resetlocalschema before, without any luck though.

When I go ahead and insert some data into the newly created table, following error arises. Note that the insert statement does not return an error.

cqlsh:mydata> insert into test(id, id2) values('test1', 'test2');
cqlsh:mydata> select * from mydata.test ;
Traceback (most recent call last):
  File "/usr/bin/cqlsh.py", line 1314, in perform_simple_statement
    result = future.result()
  File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip/cassandra-driver-3.0.0-6af642d/cassandra/cluster.py", line 3122, in result
    raise self._final_exception
Unavailable: code=1000 [Unavailable exception] message="Cannot achieve consistency level ONE" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 'ONE'}

Note that I have one datacenter and five nodes. I do not plan to use more than one datacenter in the future. [cqlsh 5.0.1 | Cassandra 3.0.8 | CQL spec 3.4.0 | Native protocol v4]

I have also restarted Cassandra multiple times. nodetool status shows that all nodes are up and running. Does anyone have a clue about what's going on?

1

1 Answers

2
votes

I fixed this by...

  1. dropping all tables in the keyspace

  2. running alter keyspace mydata WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '1'}; instead of SimpleStrategy

  3. restarting the cassandra service on all nodes

  4. recreating all tables

  5. runnning nodetool repair

Now I am able to insert data and query data again. Still not quite sure what was the cause of all this to be honest though.