获取所有key:
etcdctl get --prefix "" --endpoints=192.168.43.104:12379
删除所有key:
etcdctl del --prefix "" --endpoints=192.168.43.104:12379
查询etcd节点状态:
etcdctl --endpoints=http://192.168.43.104:12379,http://192.168.43.105:22379,http://192.168.43.106:32379 endpoint status -w table
查询etcd节点健康:
etcdctl --endpoints=http://192.168.43.104:12379,http://192.168.43.105:22379,http://192.168.43.106:32379 endpoint health -w table
循环写入etcd的bash脚本:
#!/bin/bash
beginTime=$(date "+%Y-%m-%d %H:%M:%S")
echo "beginTime:" $beginTime
number=0
while [ "${number}" -lt 90000 ]; do
etcdctl --endpoints=192.168.43.104:12379,192.168.43.105:22379,192.168.43.106:32379 put "name${number}" ${number}
number=$((number + 1))
done
endTime=$(date "+%Y-%m-%d %H:%M:%S")
echo "endtime:" $endTime
duration=$(($(date +%s -d "${endTime}")-$(date +%s -d "${beginTime}")));
echo "时间差:" $duration"s"
循环读取etcd的bash脚本:
#!/bin/bash beginTime=$(date "+%Y-%m-%d %H:%M:%S") echo "beginTime:" $beginTime number=0 while [ "${number}" -lt 90000 ]; do result="$(etcdctl --endpoints=192.168.43.104:12379 get "name${number}")" if test -z "${result}"; then echo "The result is empty. 192.168.43.104:12379的name${number}" elif [ "${result}" != "name""${number}"$'\n'"${number}" ];then echo "The result is wrong. 192.168.43.104:12379的name${number}" fi result="$(etcdctl --endpoints=192.168.43.105:22379 get "name${number}")" if test -z "${result}"; then echo "The result is empty. 192.168.43.105:22379的name${number}" elif [ "${result}" != "name""${number}"$'\n'"${number}" ];then echo "The result is wrong. 192.168.43.105:22379的name${number}" fi result="$(etcdctl --endpoints=192.168.43.106:32379 get "name${number}")" if test -z "${result}"; then echo "The result is empty. 192.168.43.106:32379的name${number}" elif [ "${result}" != "name""${number}"$'\n'"${number}" ];then echo "The result is wrong. 192.168.43.106:32379的name${number}" fi number=$((number + 1)) done endTime=$(date "+%Y-%m-%d %H:%M:%S") echo "endtime:" $endTime duration=$(($(date +%s -d "${endTime}")-$(date +%s -d "${beginTime}"))); echo "时间差:" $duration"s"
标签:name,--,benchmark,number,192.168,echo,实用,命令,result From: https://www.cnblogs.com/hd92/p/17240633.html