下载安装java
apt-get install default-jre
apt-get install openjdk-11-jdk
配置home
vim .bashrc
添加以下内容:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
刷新配置
bash
下载maven包
wget http://ftp.heanet.ie/mirrors/www.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
解压
tar xzf apache-maven-*-bin.tar.gz -C /usr/local
进入/usr/local目录
cd /usr/local
做软连接
ln -s apache-maven-* maven
编辑配置文件
vi /etc/profile.d/maven.sh
配置文件中对以下参数进行修改
export M2_HOME=/usr/local/maven
export PATH=${M2_HOME}/bin:${PATH}
刷新配置
bash
下载YCSB
curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.5.0/ycsb-0.5.0.tar.gz
解压
tar xfvz ycsb-0.5.0.tar.gz
进入YCSB目录
cd /ycsb-0.5.0
准备数据
./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://user:password@192.168.x.x:27017,192.168.x.x:27017,192.168.x.x:27017/database?w=0 -p table=table -threads 300 -p recordcount=10000000 > outputLoad.txt
执行准备数据命令报错:/usr/bin/env: ‘python’: No such file or directory 时
ln -s /usr/bin/python2.7 /usr/bin/python
开始测试
./bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://user:password@192.168.x.x:27017,192.168.x.x:27017,192.168.x.x:27017/database?w=0 -p table=table -p recordcount=10000000 -p readproportion=0.5 -p updateproportion=0.5 -p insertproportion=0 -p operationcount=100000 -threads 100 > outputRun.txt
测试结果
vi outputRun.txt