cockroach官方文档翻译---3.1 部署一个测试集群

3. 部署

3.1 部署一个测试集群


最简单的方法,去测试一个不安全的多节点的集群,使用AWSCloudFormation 模板简单的启动,使用kubernetes自动部署,缩放,管理,重新平衡客户端负载.


**在你开始之前

---限制

---要求

步骤1:开始cockroachDB

步骤2:测试cluster

步骤3:开始加载



**在你开始前

查看限制


cockroachDB AWSCloudFormation 用于测试,不用于产品


1)你对集群最多15个节点

2)


步骤2:测试集群



[root@localhostinsecure]# echo $(hostname)

localhost.localdomain

[root@localhostinsecure]# cockroach sql \

>--insecure \

>--port=26260 \

>--url="postgresql://[email protected]:26260?application_name=cockroach&sslmode=disable"

#Welcome to the cockroach SQL interface.

#All statements must be terminated by a semicolon.

#To exit: CTRL + D.

#

#Server version: CockroachDB CCL v1.1.4 (linux amd64, built 2018/01/0817:32:42, go1.8.3) (same version as client)

#Cluster ID: 389597df-d6c6-4e28-a105-82273abb89a4

#

#Enter \? for a brief introduction.

#

[email protected]:26260/>CREATE DATABASE bank;

CREATEDATABASE


Time:40.883241ms


[email protected]:26260/>CREATE TABLE bank.accounts (id INT PRIMARY KEY, balance DECIMAL);

CREATETABLE


Time:44.806569ms


[email protected]:26260/>INSERT INTO bank.accounts VALUES (1, 1000.50);

INSERT1


Time:33.69582ms


[email protected]:26260/>SELECT * FROM bank.accounts;

+----+---------+

|id | balance |

+----+---------+

| 1 | 1000.50 |

+----+---------+

(1row)


Time:4.416721ms


安装go

[root@localhost home]# yum install go -y

配置go的工作路径
[root@localhost ~]# mkdir ~/go_workspace
[root@localhost ~]# echo 'export GOPATH="$HOME/go_workspace"'>> ~/.bashrc
[root@localhost ~]# source ~/.bashrc
[root@localhost ~]# ls
anaconda-ks.cfg go_workspace
[root@localhost ~]# echo $GOPATH
/root/go_workspace

安装the rand load generator:
 
步骤3:开始一个load generator

  [root@localhost ~]# go get github.com/cockroachdb/loadgen/rand

[root@localhost bin]# pwd /root/go_workspace/bin rand --host=localhost.localdomain bank accounts

[root@localhost ~]# cd go_workspace/

[root@localhostgo_workspace]# ls

bin pkg src

[root@localhostgo_workspace]# cd bin

[root@localhostbin]# ls

rand

[root@localhostbin]# pwd


[root@localhostbin]# echo $(hostname)

localhost.localdomain

[root@localhostbin]# rand --host=localhost.localdomain bank accounts

bash: rand: commandnot found...

[root@localhostbin]# go version

go version go1.7.6linux/amd64

[root@localhostbin]# cp -i rand /usr/local/bin

[root@localhostbin]# rand --port=26260 --host=localhost.localdomain bank accounts

_elapsed___errors__ops/sec(inst)___ops/sec(cum)__p50(ms)__p95(ms)__p99(ms)_pMax(ms)

1s 0 188.9 188.9 41.9 52.4 54.5 56.6

2s 0 189.0 188.9 41.9 50.3 54.5 60.8

3s 0 188.0 188.6 44.0 52.4 54.5 54.5

4s 0 185.0 187.7 46.1 52.4 58.7 60.8

5s 0 189.0 188.0 41.9 54.5 60.8 71.3

6s 0 188.0 188.0 41.9 54.5 58.7 58.7

7s 0 189.0 188.1 41.9 52.4 54.5 54.5

8s 0 185.0 187.7 44.0 52.4 54.5 54.5

9s 0 187.0 187.7 44.0 52.4 54.5 56.6

10s 0 186.0 187.5 44.0 50.3 54.5 56.6

11s 0 188.0 187.5 41.9 52.4 58.7 58.7

12s 0 187.0 187.5 41.9 52.4 56.6 58.7

13s 0 187.0 187.5 41.9 52.4 54.5 54.

你可能感兴趣的:(cockroach)