Install Cassandra on Linux CentOS

Download the newest version of Cassandra

I wrote this tutorial using this version:

http://www.apache.org/dyn/closer.cgi?path=/cassandra/2.0.2/apache-cassandra-2.0.2-bin.tar.gz

 Commands:

$ wget http://ftp.unicamp.br/pub/apache/cassandra/2.0.2/apache-cassandra-2.0.2-bin.tar.gz
$ tar -zxvf apache-cassandra-2.0.2-bin.tar.gz
$ sudo cp -r apache-cassandra-2.0.2 /usr/local
$ cd /usr/local/apache-cassandra-2.0.2/config

Open the file:

$ vim cassandra.yaml

Check the folders in environment variables inside the file:

-data_file_directories
-commitlog_directory
-saved_caches_directory

Now, create the respective folders:

$ sudo mkdir -p /var/lib/cassandra/data
$ sudo mkdir -p /var/lib/cassandra/commitlog
$ sudo mkdir -p /var/lib/cassandra/saved_caches
$ sudo mkdir -p /var/log/cassandra

To allow the users, execute the following commands:

Current user:

$ sudo chown -R $USER:$GROUP /var/lib/cassandra
$ sudo chown -R $USER:$GROUP /var/log/cassandra

Or a specific user:

$ sudo chown -R userx:user-groupx /var/log/cassandra/
$ sudo chown -R userx:user-groupx /var/lib/cassandra/

In order to configure Cassandra to accept connections from others computers change the file:

/usr/local/apache-cassandra-2.0.2/conf/cassandra.yaml at the variable rpc_address change localhost to 0.0.0.0

Start Cassandra in the Foreground (Testing environment)

$ /usr/local/apache-cassandra-2.0.2/bin/cassandra -f

Start Cassandra in the Background

$ /usr/local/apache-cassandra-2.0.2/bin/cassandra

To kill the process:

$ pkill -f CassandraDaemon

OS X tip – Show all files in the Finder

OS X quick tip!

To show all files and folders in the Finder, including the hidden ones, open the Terminal window and execute the following commands:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Open the Finder and check it out.

If you didn’t like it, just revert. Execute:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Take care!

RBENV: Quick Tutorial

In this tutorial, I will consider you are using OSX, so Homebrew!

Open the terminal and execute:

brew install rbenv

Next:

brew install ruby-build

Edit the file:

.bash_profile

At the end append the following line:

eval "$(rbenv init -)"

Save and close the file. Load the new configuration. To do it, execute the command:

source ~/.bash_profile

Afterward, go to the site Ruby and download the newest stable version. For this tutorial, I used the version 2.1.2. In the terminal window execute:

rbenv install 2.1.2

Next:

rbenv rehash 

To switch between Rubi versions using RBENV, just type:

rbenv global [versão]

Using global there are other options; take a look at the documentation. So:

rbenv global 2.1.2

Checking the current version:

ruby -v

List all available versions:

rbenv versions

Now you can manage which will be the main version and switch between the options using RBENV. Don’t forget to execute:

rbenv rehash

After installing a new Ruby version or a new Gem in any environment.