I'm using YCSB(Yahoo! Cloud Serving Benchmark) for performance measurement of 2 node Cassandra(2.0.2) cluster deployed on CentOS. For loading data using YCSB I executed the following --
bin/ycsb load cassandra -P workloads/cassandraLoadA -s files/load.dat
This line uses property file cassandraLoadA and and stores the YCSB generated in load.dat . Here ycsb file is written in Python. Now I want to execute the above from a Java program. I tried with ProcessBuilder and Runtime object but failed.
Using ProcessBuilder Object-
ProcessBuilder builder = new ProcessBuilder("/DIRECTORY_HERE/bin/ycsb","load","cassandra","-P", "workloads/cassandraLoadA","-s","files/load.dat");
Map<String, String> environ = builder.environment();
final Process process = builder.start();
Using Runtime Object -
Process p = Runtime.getRuntime().exec("cd /DIRECTORY_HERE/bin/ycsb load cassandra -P workloads/cassandraLoadA -s files/load.dat");
p.waitFor();
Q1 : Am I doing anything wrong here ?
Q2 : How can it be accomplised ?
Best Regards-
Avijoy
Try composing the whole command as a String and then pass it to the ProcessBuilder