---
# System prepended metadata

title: etcdbenchmark 測試 etcd 叢集

---

etcdbenchmark 測試 etcd 叢集
===
## etcd 測試
* 分下列三種：
    * 線性讀取
    * 序列化讀取
    * 寫入

### 線性讀取： 
* 取得k8s secrets key
```shell=
kubectl get secrets
```
![](https://i.imgur.com/vzyYvPJ.png)
* 查看key.pem & .pem
![](https://i.imgur.com/QH8KsgT.png)
* 跑etcd benchmark
```shell=
docker run -v /opt/rke/etc/kubernetes/ssl:/ssl fangruo/etcd-benchmark:1.0 benchmark --cacert="/ssl/kube-ca.pem" --endpoints="$etcdip1:2379,$etcdip2:2379,$etcdip3:2379" --key="/ssl/kube-etcd-172-25-4-171-key.pem" --cert="/ssl/kube-etcd-172-25-4-171.pem" --conns=100 --clients=1000 range /registry/secrets/default/$secrets --consistency=l --total=100000
```
### 序列化讀取： 
```shell=
docker run -v /opt/rke/etc/kubernetes/ssl:/ssl fangruo/etcd-benchmark:1.0 benchmark --cacert="/ssl/kube-ca.pem" --endpoints="$etcdip1:2379,$etcdip2:2379,$etcdip3:2379" --key="/ssl/kube-etcd-172-25-4-171-key.pem" --cert="/ssl/kube-etcd-172-25-4-171.pem" --conns=100 --clients=1000 range /registry/secrets/default/$secrets --consistency=s --total=100000
```
### 寫入： 
```shell=
docker run -v /opt/rke/etc/kubernetes/ssl:/ssl fangruo/etcd-benchmark:1.0 benchmark --cacert="/ssl/kube-ca.pem" --endpoints="172.25.4.171:2379,172.25.4.172:2379,172.25.4.173:2379" --key="/ssl/kube-etcd-172-25-4-171-key.pem" --cert="/ssl/kube-etcd-172-25-4-171.pem" put --conns=100 --clients=1000 --key-size=8 --sequential-keys --total=100000 --val-size=256
```