Setup a multinode Cassandra using Ubuntu 12.04 and Virtualbox

1. Setup virtual machines (3 for exmaple)

  • You should first setup one machine using virtualbox, setup JAVA environment, download the Cassandra source code

  • Use Virtualbox’s virtualmanager function to copy another two ubuntu machines. Make sure to modify the hostname.

  • Modify the /etc/hosts file.

  • Machine summary

    • 192.168.56.101 sjhadoop0
    • 192.168.56.103 sjhadoop1
    • 192.168.56.104 sjhadoop2

2. Config Cassandra

  • Modify /conf/cassandra-env.shfile.

      MAX_HEAP_SIZE="512M"
      HEAP_NEWSIZE="128M"
    
  • Modify /conf/cassandra.yaml file. For each virtual machine, change listen_address and rpc_addressaccordingly.

      listen_address: 192.168.1.1
      rpc_address: 192.168.1.1
    
  • Choose one first machine as seed. Then change seeds to its ip address, make the rest VM pointing to the same seed.

      seeds: - 192.168.1.1
    
  • Assign initial_token, using the this python code to generate initial token and modify the initial_token in .yaml file.

3. Start Cassandra

	sudo ./bin/cassandra -f

That’s it!!