Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reinstall a cassandra on ubuntu?

Tags:

I'm newbie in the Ubutu(linux) + Cassandra.

I tested Cassandra on my ubuntu machine with OpenJdk. There are some nice articles to explain how to install a Cassandra on ubuntu, so I could do that. I changed some config values and checked it run correctly.

And, I decided to remove the cassandra and reinstall for getting the clean one.

[What-I-Do]

I uninstall Cassandra with following steps:

  1. uninstall Cassandra using apt-get

    apt-get remove cassandra

  2. remove data/log/ directories

    rm -rf /var/lib/cassandra

    rm -rf /var/log/cassandra

    rm -rf /etc/cassandra

After that I tried to install new cassandra

apt-get install cassandra

[Error-Message]

sudo cassandra -f

Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.RuntimeException: Couldn't figure out log4j configuration: log4j-server.properties

at org.apache.cassandra.service.AbstractCassandraDaemon.initLog4j(AbstractCassandraDaemon.java:86)

at org.apache.cassandra.thrift.CassandraDaemon.(CassandraDaemon.java:62) Could not find the main class: org.apache.cassandra.thrift.CassandraDaemon. Program will exit.`

and there are no files under "/var/lib/cassandra", "/var/log/cassandra" and "/etc/cassandra" directories OTL.

I want to know, what I miss.

like image 926
Ryan Ryu Avatar asked Nov 15 '12 02:11

Ryan Ryu


People also ask

Where is Cassandra installed Linux?

Note − If you have installed Cassandra from a deb or rpm package, the configuration files will be located in /etc/cassandra directory of Cassandra. The above command opens the cassandra. yaml file. Verify the following configurations.

How do I know if Cassandra is installed on Linux?

You can validate Cassandra installation by one of the following ways or can try all: Check the status of the Cassandra nodes in your cluster - Go to the /<Install_Dir>/apache-cassandra/bin/ directory and type the ./nodetool status command. If the status for all the nodes shows as UN , then the nodes are up and running.


1 Answers

I was able to completely uninstall Cassandra by doing the following:

apt-get remove cassandra 

--- removing the cassandra directories

rm -rf /var/lib/cassandra rm -rf /var/log/cassandra rm -rf /etc/cassandra 

However, after doing the above, there are still some things left behind, and if you were to try to reinstall it after doing this, it does not work, because the install detects those remaining files and believes you still have an installation of the software. You will get a new set of directories, but they will be empty. So, you need to remove all the additional stuff. There are directories and files that need to be manually removed.

--- finding the remaining Cassandra files

find / -name 'cassandra'  

or,

find / -name '*cassandra*' 

(ALL remaining files on the system need to be removed or a few directories are left empty or not even created at all).

The above command will return a listing of files and directories left behind. Remove them.

Now, you should be able to do:

apt-get update 

followed by:

apt-get install cassandra 

After doing this, I got a full new installation, and upon starting Cassandra, it did all the first-time startup stuff and got up and running.

If you get a GPG error about signatures not being verified because of a public key, that needs to be set up before the install statement.

like image 174
user3626148 Avatar answered Sep 30 '22 20:09

user3626148