howto:cassandra_fix_upgrade_ubuntu
Upgrading Cassandra on Ubuntu 14.04 and fixing IllegalStateException
Note that this recipe may also be used to reinstall cassandra!
Upgrading Cassandra via apt-get
to version 3.0.0 (from 2.x) gives the following barf:
ERROR 08:40:42 Exception encountered during startup java.lang.IllegalStateException: One row required, 2 found at org.apache.cassandra.cql3.UntypedResultSet$FromResultSet.one(UntypedResultSet.java:84) ~[apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.schema.LegacySchemaMigrator.readTableTimestamp(LegacySchemaMigrator.java:230) ~[apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.schema.LegacySchemaMigrator.readTable(LegacySchemaMigrator.java:220) ~[apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.schema.LegacySchemaMigrator.lambda$readTables$225(LegacySchemaMigrator.java:214) ~[apache-cassandra-3.0.0.jar:3.0.0] at java.util.ArrayList.forEach(ArrayList.java:1249) ~[na:1.8.0_66] at org.apache.cassandra.schema.LegacySchemaMigrator.readTables(LegacySchemaMigrator.java:214) ~[apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.schema.LegacySchemaMigrator.readKeyspace(LegacySchemaMigrator.java:163) ~[apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.schema.LegacySchemaMigrator.lambda$readSchema$222(LegacySchemaMigrator.java:154) ~[apache-cassandra-3.0.0.jar:3.0.0] at java.util.ArrayList.forEach(ArrayList.java:1249) ~[na:1.8.0_66] at org.apache.cassandra.schema.LegacySchemaMigrator.readSchema(LegacySchemaMigrator.java:154) ~[apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.schema.LegacySchemaMigrator.migrate(LegacySchemaMigrator.java:77) ~[apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:223) [apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:561) [apache-cassandra-3.0.0.jar:3.0.0] at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:689) [apache-cassandra-3.0.0.jar:3.0.0]
I was joking earlier with one of my students that he doesn't know how to use Google (he had some silly error when running Cassandra). Turns out the joke's on me because I could not find this anywhere on the www. Here is what I ended up doing (this works, hopefully):
sudo apt-get purge cassandra
- note that this also removes configuration files.- Some directories are unable to be deleted (because they still contain “something”) -
sudo rm -Rf /var/lib/cassandra
andsudo rm -Rf /var/log/cassandra
will restore the order of things in the universe - Install the new and shiny Cassandra with
sudo apt-get purge cassandra
- The python driver between 2.x and 3.x is incompatible so needs to be uninstalled and reinstalled (or just upgraded perhaps? I'm not taking chances).
sudo pip uninstall cassandra-driver
andsudo pip install cassandra-driver
should fix this. Note that the installation part is somewhat slow (but it's not hanged).
Cassandra (currently 3.0.0) should automatically start (and run) on port 7000 (default).
howto/cassandra_fix_upgrade_ubuntu.txt · Last modified: 2018/10/09 10:12 by 127.0.0.1