Code Monkey home page Code Monkey logo

cs4224_cassandra's Introduction

CS4224 Cassandra

Project Setup

1. Install Cassandra

Please refer to the installation instructions from Cassandra docs: http://cassandra.apache.org/doc/latest/cassandra/getting_started/installing.html

2. Install Python dependencies

You may use either pipenv or manual installation to install the python dependencies.

a) Using pipenv

pip install pipenv
pipenv install
pipenv shell

b) Manual installation

pip install cassandra-driver

3. Download data from CS4224 website

The data files are not included in this repository due to their large size. You may either download and extract them manually, or run the following commands in the project's root.

wget http://www.comp.nus.edu.sg/~cs4224/project_files_4.zip
unzip project_files_4.zip

Now, you should see a folder called project_files_4 in the project's root folder.

Configuration details

Modifications to conf/cassandra.yaml

1. Configure setup

Cluster name: "CS4224B Cluster"	
listen_address: 192.168.48.169 (replace this with node ip)
rpc_address: 192.168.48.169 (replace this with node ip)
seeds: "192.168.48.169,192.168.48.170" 
native_transport_port: 6042
storage_port: 6000
ssl_storage_port: 6001

2. Configure timeout

read_request_timeout_in_ms: 120000 
range_request_timeout_in_ms: 400000
write_request_timeout_in_ms: 50000
request_timeout_in_ms: 400000 

Modifications to bin/cqlsh.py

Set the default consistency level to LOCAL_QUORUM

self.consistency_level = cassandra.ConsistencyLevel.LOCAL_QUORUM

Modifications to client configuration file

1. Configure IP_ADDRESSES

In create_db_tables.py, you can modify the variables for IP_ADDRESSES. For example, if you wish to use the IP addresses 192.168.48.169 and 192.168.48.170 on port 6042, you can change IP_ADDRESSES as shown below. If no port is supplied, the default port is 9042.

IP_ADDRESSES = [('192.168.48.169', 6042), ('192.168.48.170', 6042)]

2. Configure consistency level

If you wish to use a different consistency level than CONSISTENCY_LEVEL.ONE, please change the CONSISTENCY_LEVEL variable to the appropriate consistency level. For example:

CONSISTENCY_LEVEL = ConsistencyLevel.LOCAL_QUORUM

Running the experiments

1. Install sshpass if you don't have it installed on your machine.

Then, ssh to each machine from xcnc20 to xcnc24

sshpass -p <cluster_password> ssh [email protected]

2. Start Cassandra on each machine

cassandra

3. Set up the datacenter

cd temp/CS4224_Cassandra
python3 create_db_tables.py
python3 clean_data.py
cqlsh 192.168.48.169 6042 -f create_index.cql
cqlsh 192.168.48.169 6042 -f load_db_data.cql

4. In your terminal, run the experiment

bash run_experiment.sh <cluster_password> <experiment_type>

experiment_type should either be A or B

5. Upon completion of experiment, compute the statistics

python3 consolidate_client_results.py
python3 compute_throughput_statistics.py
python3 compute_end_state_statistics.py

Useful commands

Check cassandra's logs

tail -f ~/temp/apache-cassandra-4.0.1/logs/system.log

Check status of nodes

nodetool status

Check logs of experiment from your terminal

tail -f nohup.out

Stop existing cassandra processes

ps ax | grep cassandra
kill <process id>

cs4224_cassandra's People

Contributors

lebencwb avatar limning avatar teikjun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.