Cassandra is a highly scalable, eventually consistent, distributed, structured key-value store. It’s an alternative to SQL if you don’t need relational data structures. The best part is it’s super fast, and distributed. The worst part is there’s not much documentation or community, at least compared to MySQL. So, I’m doing my small part to contribute to Cassandra. Here’s how I installed Cassandra on Ubuntu 8.04.2 LTS (hardy), but these directions should work on pretty much any Linux distro.
1. First upgrade your software as is with the following two commands (just for good measure):
sudo apt-get update sudo apt-get upgrade
2. Now, open up your Debian package sources list with Nano for editing using the following command:
sudo nano /etc/apt/sources.list
3. Next, add the following sources to your /etc/apt/sources.list file.
deb http://www.apache.org/dist/incubator/cassandra/debian unstable main deb-src http://www.apache.org/dist/incubator/cassandra/debian unstable main
After you add these two lines, press cntrl+X to close Nano. It’ll ask “Save modified buffer?” Press Y. Press Enter when Nano asks “File Name to Write.”
4. Run the update to install Casandra with this command:
sudo apt-get update
5. ERROR! At this point you receive an error similar to this:
W: GPG error: http://www.apache.org unstable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F758CE318D77295D
6. Use the following three commands to ignore the signature error, and continue installing:
NOTE: You must replace the key value ‘F758CE318D77295D’ with the key value you received in your error message.
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys F758CE318D77295D sudo apt-key add ~/.gnupg/pubring.gpg sudo apt-get update
7. Install Cassandra:
sudo apt-get install cassandra
8. Next you need to change Cassandra’s default port number from 8080 to something else, because the 8080 port typically conflicts with SSH terminal connections. Use Nano to open up the Cassandra configuration file using the following command:
sudo nano /usr/share/cassandra/cassandra.in.sh
9. Then change the port number 8080 on the following line to 10036, and save the file:
-Dcom.sun.management.jmxremote.port=10036 \
10. Start Cassandra with the command:
/etc/init.d/cassandra start
Once you have Cassandra running, test it with Cassandra’s command line tool CLI. Use the example found on the Cassandra Wiki.
I’ve tried following this how-to on a machine with Ubuntu 9.10, and despite having JAVA_HOME correctly set (and yes, I’m quite sure of that), the Cassandra installed by the 0.4.2 Debian package kept insisting that it “Cannot locate Java Home”.
Without changing anything else, I went and downloaded the 0.5.0-rc3 binary from the apache incubator website instead which, surprisingly enough, worked just fine – though I do hate bypassing the package manager. <.<
I also got the “Cannot locate Java Home” message. I saw that the inti script had the JAVA_HOME hardcoded to /usr/lib/jvm/java-6-openjdk so I simply made a symlink:
sudo ln -s /usr/lib/jvm/java-6-sun /
/usr/lib/jvm/java-6-openjdk
I also got the “Cannot locate Java Home” message. I saw that the init script had the JAVA_HOME hardcoded to /usr/lib/jvm/java-6-openjdk so I simply made a symlink:
sudo ln -s /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-6-openjdk
You should consider putting the deb stanzas in a file like /etc/apt/sources.list.d/cassandra.list instead of sources.list
Trying to connect to the instance via the CLI results in an exception though. Investigating.
BTW the 0.5.0 binary is now available via deb.
I get a permission denied on the logs, but when I look at the log files they are owned by root. The /etc/init.d/cassandra start starts the app as root, so I’m bit confuses as to how this could happen. I’m using java-6-openjdk and have the $JAVA_HOME set to the directory that holds the javac executable, i.e. echo $JAVA_HOME yielded /usr/lib/jvm/java-6-openjdk/bin/
The error message quite massive, but the first couple of lines seem to say it all log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)
and
/var/log/cassandra$ ls -al
total 20
drwxr-xr-x 2 root root 4096 2010-03-15 19:16 .
drwxr-xr-x 15 root root 4096 2010-03-15 20:36 ..
-rw——- 1 root root 2215 2010-03-15 20:37 output.log
-rw——- 1 root root 4537 2010-03-15 20:37 system.log
I’ve also tried adding right to the root group to be able to read and write, but luck
Any thoughts?
hava U finished installing cassandra in ubuntu? I met the same mistake with you while installing…
Regarding the previous posting about permission denied to the log files: I removed the files and they automatically regenerated correctly
“Next you need to change Cassandra’s default port number from 8080 to something else, because the 8080 port typically conflicts with SSH terminal connections.”
This may lead people to believe that the default port that Cassandra listens for clients on is 8080. This is in fact the JMX interface port, which exposes metrics and some admin operations.
Per http://wiki.apache.org/cassandra/FAQ#ports
”
By default, Cassandra uses 7000 and 7001 for cluster communication, 9160 for clients (Thrift), 8888 for java remote debugging, and 8080 for JMX.
”
Clients, including the cassandra-cli client, should connect to 9160 in the default config.
=Rob
These instructions no longer work. The URLs that go in sources.list are now 404s. See http://wiki.apache.org/cassandra/DebianPackaging for updated instructions.
Hi.
Just to note the correct apt URLs now are:
deb http://www.apache.org/dist/cassandra/debian unstable main
deb-src http://www.apache.org/dist/cassandra/debian unstable main
(I guess it’s because Cassandra graduated out of the incubator)
I just downloaded Cassandra 0.6.4.
After creating serveral folders and a document as storage-conf.xml & log4j.properties mentioned, I’m playing Cassandra on ubuntu now.
Installed Cassandra 0.6.5 on Ubuntu 10.04 . To modify the default JMX_PORT from 8080 i had to edit:
/etc/default/cassandra
Settings in that file seem to overwrite any other settings.
Unable to redirect to /var/log/cassandra/output.log
Cannot open PID file /var/run/cassandra.pid, PID is 2039
Service exit with a return value of 255
to fix this error just run cassandra from root user privileges
sudo /etc/init.d/cassandra start
I am able to setup cassandra on ubuntu but when executing following command
paranjai@ubuntu:~$ /etc/init.d/cassandra start
Following error is received
cat: /var/run/cassandra.pid: Permission denied
Cannot set group id for user ‘cassandra’
Error validating user ‘cassandra’
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
cat: /var/run/cassandra.pid: Permission denied
any help is appreciated . Thanks
Try running it under sudo. This should help!
The lines in source.list should be change to:
deb http://www.apache.org/dist/cassandra/debian unstable main
deb-src http://www.apache.org/dist/cassandra/debian unstable main
Source:
http://wiki.apache.org/cassandra/DebianPackaging
Hi,
I am stuck on number 6.
Here is what I get:
[…]
gpg: requesting key … from hkp server wwwkeys.eu.pgp.net
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error
Thanks in advance for your help.
I also had trouble with step 6. It seems the keyserver at pgp.net is a little flaky? I had success with the keyserver at MIT:
gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | sudo apt-key add -
Ignore all previous sources.lst recommendations and just go here for the official situation
http://wiki.apache.org/cassandra/DebianPackaging
the 3rd point should be updated, the lies to be added to /etc/apt/sources.list should be something like this :
deb http://apache.org/dist/cassandra/debian 10x main
deb-src http://apache.org/dist/cassandra/debian 10x main
The latest instructions from Apache foundation.
http://wiki.apache.org/cassandra/DebianPackaging
the resouce you have are outdated , use this instead :
deb http://www.apache.org/dist/cassandra/debian 11x main
deb-src http://www.apache.org/dist/cassandra/debian 11x main
full discription can be found at http://wiki.apache.org/cassandra/DebianPackaging