# https://www.digitalocean.com/community/tutorials/how-to-install-cassandra-and-run-a-single-node-cluster-on-ubuntu-14-04
# Note YCSB 0.5.0 hasn't supported latest versions of Cassandra (3.0+), so just install Cassandra 2.2.3.
# To check it running as a service:
sudo service cassandra status
# To start and stop the service
sudo service cassandra start
sudo service cassandra stop
# check the nodetool:
nodetool status
# may include some ip and port parameters:
nodetool -host 127.0.0.1 -p 9042 status
# To operate databases, use the cql shell in terminal:
cqlsh
# If running cassandra in the foreground when you are logged in as "hduser", you need to change their ownership to the current user. Not necessary:
# sudo chown -R hduser:hadoop /var/log/cassandra
# sudo chown -R hduser:hadoop /var/lib/cassandra
# When sudo running cassandra as service, the ownership of the above folders
# should be changed back to "cassandra":
# sudo chown -R cassandra /var/log/cassandra
# sudo chown -R cassandra /var/lib/cassandra
# Before using YCSB, enter the cqlsh, and create database in Cassandra as below:
CREATE KEYSPACE ycsb WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1 };
USE ycsb;
CREATE TABLE usertable (
y_id varchar primary key,
field0 varchar,
field1 varchar,
field2 varchar,
field3 varchar,
field4 varchar,
field5 varchar,
field6 varchar,
field7 varchar,
field8 varchar,
field9 varchar);
# So that cassandra has the database to accept ycsb workloads.
# Some parts of workloads failed due to timeout when writing.To overcome this issue:
# Find the "cassandra.yaml" file (if you installed it by sudo apt-get, this file should be under /etc/cassandra),
# Find the settings in the file, words like:
write_request_timeout_in_ms: 2000# Change this value and other similar settings into 30000 - 60000 so most timeouts will disappear.
# Reboot your Ubuntu, check if cassandra service is running by typing in terminal:
sudo service cassandra status
# If not, check the repairing method from the website linked above.
# So Cassandra is all set ready.
# For YCSB:
# Copy the following two files into your "ycsb-0.5.0/cassandra2-binding/lib" directory (downloaded from http://www.slf4j.org/download.html):
slf4j-api-1.7.13.jar
slf4j-simple-1.7.13.jar
# Remove or rename the following file in the same directory:
slf4j-api-1.6.4.jar
# Then off you go!!
# Example:
# Under the ycsb-0.5.0 directory, try to run in the terminal:
./bin/ycsb load cassandra2-cql -P workloads/workloada -p hosts=localhost
./bin/ycsb run cassandra2-cql -P workloads/workloada -p hosts=localhost
# After running workloads, clear the usertable:
# In the terminal:
cqlsh
# In the cql shell:
use ycsb;
truncate usertable;
exit;
# So everything is done.
没有评论:
发表评论