1. YCSB安装
wget https://github.com/downloads/brianfrankcooper/YCSB/ycsb-0.1.4.tar.gz
tar zxvf ycsb-0.1.4.tar.gz
cd ycsb-0.1.4
Or clone the git repository and build:
git clone git://github.com/brianfrankcooper/YCSB.git
cd YCSB
mvn clean package
2. 下载apache-cassandra-1.2.19-bin.tar.gz,根据README创建路径:
* tar -zxvf apache-cassandra-$VERSION.tar.gz
* cd apache-cassandra-$VERSION
* sudo mkdir -p /var/log/cassandra
* sudo chown -R `whoami` /var/log/cassandra
* sudo mkdir -p /var/lib/cassandra
* sudo chown -R `whoami` /var/lib/cassandra
3. 运行测试:
(1)进入cassandra源码目录bin,
执行:./cassandra -f
(2)另外开一个窗口执行./cassandra-cli,输入以下内容:
CREATE KEYSPACE usertable
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:2};
use usertable;
create column family data with comparator=UTF8Type and
default_validation_class=UTF8Type and key_validation_class=UTF8Type;
(3)进入ycsb/bin/执行
#./bin/ycsb load cassandra-10 -P workloads/workloadc -p threads=3 -p recordcount=100000 -p hosts=localhost -s >load.dat
#./bin/ycsb load cassandra-10 -P workloads/workloadc -p threads=3 -p recordcount=10000 -p hosts=127.0.0.1 -s >load.dat
bin/ycsb load cassandra-10 -P workloads/workloadc -p threads=<thread-numbers>
-p recordcount=<recorcount-value> -p hosts=<hostips> -s >load.dat
A few notes about this command:
<thread-number> : the number of client threads, this is often done to increase the amount of
load offered against the database.
<recorcount-value> : the total records for this benchmark. For example, when you want to
load 10GB data you shout set it to 10000000.
<hostips> : the IP of cassandra’s nodes. If you have more than one node you should divide
with “,
ip地址写127.0.0.1
错误及解决办法: