简体   繁体   中英

Cannot reinstall Cassandra on Ubuntu 18.04

I have a standard version of Ubuntu 18.04 freshly installed and want to use it as a Cassandra node.

I went through the following steps to install Cassandra:

##
## Install java 1.8
sudo apt install openjdk-8-jre -y
##
## Check java version
java -version
##
## Create the JAVA_HOME link
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile
echo $JAVA_HOME
##
## Create the Apache Cassandra 3.11.x apt repo:
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo apt-get update
##
## If GPG public key error
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
sudo apt-get update
##
## Install cassandra
sudo apt-get install cassandra
##
## Service status
sudo service cassandra status

Output:

cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/init.d/cassandra; generated)
Active: active (exited) since Thu 2018-08-02 23:03:47 UTC; 4h 2min ago
 Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 4662)
CGroup: /system.slice/cassandra.service

The "active (exited)" part makes me think something went wrong.

I wanted to give it a re-try, and uninstall cassandra by doing:

sudo apt-get remove cassandra
sudo apt-get purge "cassandra-*"
sudo rm -rf /var/lib/cassandra
sudo rm -rf /var/log/cassandra
sudo rm -rf /etc/cassandra
sudo apt-get update

went through the same installing steps, and now /etc/cassandra contains only /triggers/, all configuration files are missing.

My guess is that I haven't completely cleant up something

In my limited debian/ubuntu experience, purging a package does nothing for removing dependencies. So people make the mistake that if they purge a package, then their system is returned to the state that it was in before the package was installed, which isn't true because all off the dependencies and their config files are still in the system.

So when removing a package, remove the dependencies too. I would do something like this:

sudo apt-get remove package_name
sudo apt-get purge package_name
sudo apt-get --purge autoremove
sudo apt-get clean

As far as your original problem, I would ask if it logged any errors in /var/log/cassandra/system.log but it looks like you deleted the logs.

Did java -version output what you expected?

Also make sure you have python and python-support installed

After doing a google search, you could check this out Cassandra status changing from active(running) to active(exited) without any errors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM