自动化测试Cassandra脚本

准备工作

安装6台Ubuntu9.10的64位系统
安装JDK
配置双向ssh
安装Cassandra
测试工具使用YCSB Benchmark

测试脚本

1.远程关闭cassandra

#!/bin/sh
for line in `cat server_list.txt`
do
ssh root@$line "pgrep -f cassandra |xargs kill -9 && echo KillOK && exit"
done
for line in `cat server_list.txt`
do
ssh root@$line "ps aux | grep cassandra"
done

10.11.1.140
10.11.1.142
10.11.1.143
10.11.1.144
10.11.1.145
10.11.1.146
seerver_list.txt


2. 远程修改Cassandra配置文件并且重启Cassandra

#!/bin/sh
count=1
for lin in `cat list.txt`
do
  var[count]=`echo $lin | cut -d '=' -f 2`
  count=$[count+1]
done
for line in `cat server_list.txt`
do
ssh root@$line "echo ssh OK------------------------------------------------ && cp -f /root/apache-cassandra-0.6.6/conf/storage-conf.xml /root/apache-cassandra-0.6.6/conf/storage-conf.xml.bk && echo copy OK--------------------------------------&& sed -e 's/<ConcurrentReads>.*<//ConcurrentReads>/<ConcurrentReads>${var[1]}<//ConcurrentReads>/g' -e 's/<ColumnFamily Name=/"data/" RowsCached=/".*/"/<ColumnFamily Name=/"data/" RowsCached=/"${var[3]}/"/g' -e 's/KeysCached=/".*/ //>/KeysCached=/"${var[2]}/" //>/g' -e 's/<IndexInterval>.*<//IndexInterval>/<IndexInterval>${var[4]}<//IndexInterval>/g' -e 's/<MemtableOperationsInMillions>.*<//MemtableOperationsInMillions>/<MemtableOperationsInMillions>${var[5]}<//MemtableOperationsInMillions>/g' -e 's/<MemtableThroughputInMB>.*<//MemtableThroughputInMB>/<MemtableThroughputInMB>${var[6]}<//MemtableThroughputInMB>/g' /root/apache-cassandra-0.6.6/conf/storage-conf.xml.bk > /root/apache-cassandra-0.6.6/conf/storage-conf.xml && echo modify OK----------------------------------------------- && sleep 4 && echo have a sleep------------------------------------------------ && nohup /root/apache-cassandra-0.6.6/bin/cassandra & exit"
done


ConcurrentReads=4
KeysCached=5000000
RowsCached=0
IndexInterval=128
MemtableOperationsInMillions=0.3
MemtableThroughputInMB=64

list.txt


后续脚本为本地自动化YCSB测试

老师教育我们学计算机的人不应该动手去做重复的事情,极是!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值