Skip to content

Commit

Permalink
Refine ClusterInfo & Instance (#591)
Browse files Browse the repository at this point in the history
Signed-off-by: Breezewish <me@breeswish.org>
  • Loading branch information
breezewish authored Jun 8, 2020
1 parent 715cc6a commit ca11e4d
Show file tree
Hide file tree
Showing 83 changed files with 3,472 additions and 2,077 deletions.
2 changes: 2 additions & 0 deletions etc/manualTestEnv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vagrant/
tiup-cluster-*.log
12 changes: 12 additions & 0 deletions etc/manualTestEnv/_shared/Vagrantfile.partial.pubKey.ruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Vagrant.configure("2") do |config|
ssh_pub_key = File.readlines("#{File.dirname(__FILE__)}/vagrant_key.pub").first.strip

config.vm.box = "hashicorp/bionic64"
config.vm.provision "shell", privileged: false, inline: <<-SHELL
sudo apt install -y zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sudo chsh -s /usr/bin/zsh vagrant
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
SHELL
end
27 changes: 27 additions & 0 deletions etc/manualTestEnv/_shared/vagrant_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEAxboZzYumqNoVOQ/hKKhIZHxNhf5tmnkLZry8i6Xur4FPLDiRxos/
xVVDx0ynTPOyQVVaXtNxZnAmbR4HuNBzRvNoklwSXazt5YgWeiKCHtPpKFt3PJeE2cn6FJ
p6F6qFChG0NSPbZxJWWxv4noX0U3PLKgHNIehYK2Fu0E6plhSZazzJEVWapwo9d7aGnAsz
bBCd5TNZ5ogrXn+3bSFcdCbAfWOwYg54a+PzTQlzgt6JmhlEjpFfPhhpBW92pQXxmQ2c17
iPCbA8G++FiaEwA5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p/4FevfxHU7wTcoFEp3PItUlcxYqO8vY2VCZ913oNLKBIt9p
uFfG2BZM5szMRNMh0svelu61FePsfN5Z8J0ltPrS8UKB95ywAAAIEAywbyNbjz1AxEjWIX
2Vbk4/MjQyjui8Wi7H0F+LDWyMfPJHzhnbr79Z/lIZmDAo++3EYU9J9s0C+wJ6vXGK+gvC
7e5qGfT/0J0DwBfLbpeTdDELCa/LmfLWVPzZ9Q+9Fq0AjmW9YXFZ/+qT9xfY1v9XfztFRS
xR1iXJ42q6ff5NsAAAAeYnJlZXpld2lzaEBCcmVlemV3aXNoTUJQLmxvY2FsAQIDBAU=
-----END OPENSSH PRIVATE KEY-----
1 change: 1 addition & 0 deletions etc/manualTestEnv/_shared/vagrant_key.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFuhnNi6ao2hU5D+EoqEhkfE2F/m2aeQtmvLyLpe6vgU8sOJHGiz/FVUPHTKdM87JBVVpe03FmcCZtHge40HNG82iSXBJdrO3liBZ6IoIe0+koW3c8l4TZyfoUmnoXqoUKEbQ1I9tnElZbG/iehfRTc8sqAc0h6FgrYW7QTqmWFJlrPMkRVZqnCj13toacCzNsEJ3lM1nmiCtef7dtIVx0JsB9Y7BiDnhr4/NNCXOC3omaGUSOkV8+GGkFb3alBfGZDZzXuI8JsDwb74WJoTADm157HyTX4fOYd/tiPKE+v4jrsTMSIi54mDb7Q9hszWnTpLyRVM0Nex/R4nHgOvyp
36 changes: 36 additions & 0 deletions etc/manualTestEnv/multiHost/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# multiHost

TiDB, PD, TiKV, TiFlash each in different hosts.

## Usage

1. Start the box:

```bash
vagrant up
```

1. Use [TiUP](https://tiup.io/) to deploy the cluster to the box (only need to do it once):

```bash
tiup cluster deploy multiHost v4.0.0 topology.yaml -i ../_shared/vagrant_key -y --user vagrant
```

1. Start the cluster in the box:

```bash
tiup cluster start multiHost
```

1. Start TiDB Dashboard server:

```bash
bin/tidb-dashboard --pd http://10.0.1.11:2379
```

## Cleanup

```bash
tiup cluster destroy multiHost -y
vagrant destroy --force
```
14 changes: 14 additions & 0 deletions etc/manualTestEnv/multiHost/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load "#{File.dirname(__FILE__)}/../_shared/Vagrantfile.partial.pubKey.ruby"

Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 1
end

(1..4).each do |i|
config.vm.define "node#{i}" do |node|
node.vm.network "private_network", ip: "10.0.1.#{i+10}"
end
end
end
42 changes: 42 additions & 0 deletions etc/manualTestEnv/multiHost/topology.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
global:
user: tidb
deploy_dir: tidb-deploy
data_dir: tidb-data

server_configs:
tikv:
server.grpc-concurrency: 1
raftstore.apply-pool-size: 1
raftstore.store-pool-size: 1
readpool.unified.max-thread-count: 1
readpool.storage.use-unified-pool: false
readpool.coprocessor.use-unified-pool: true
storage.block-cache.capacity: 256MB
raftstore.capacity: 10GB
pd:
replication.enable-placement-rules: true

pd_servers:
- host: 10.0.1.11
- host: 10.0.1.12
- host: 10.0.1.13

tikv_servers:
- host: 10.0.1.12

tidb_servers:
- host: 10.0.1.11
- host: 10.0.1.12
- host: 10.0.1.13

tiflash_servers:
- host: 10.0.1.14

grafana_servers:
- host: 10.0.1.11

monitoring_servers:
- host: 10.0.1.11

alertmanager_servers:
- host: 10.0.1.11
36 changes: 36 additions & 0 deletions etc/manualTestEnv/multiReplica/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# multiReplica

Multiple TiKV nodes in different labels.

## Usage

1. Start the box:

```bash
vagrant up
```

1. Use [TiUP](https://tiup.io/) to deploy the cluster to the box (only need to do it once):

```bash
tiup cluster deploy multiReplica v4.0.0 topology.yaml -i ../_shared/vagrant_key -y --user vagrant
```

1. Start the cluster in the box:

```bash
tiup cluster start multiReplica
```

1. Start TiDB Dashboard server:

```bash
bin/tidb-dashboard --pd http://10.0.1.20:2379
```

## Cleanup

```bash
tiup cluster destroy multiReplica -y
vagrant destroy --force
```
10 changes: 10 additions & 0 deletions etc/manualTestEnv/multiReplica/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load "#{File.dirname(__FILE__)}/../_shared/Vagrantfile.partial.pubKey.ruby"

Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 4 * 1024
v.cpus = 2
end

config.vm.network "private_network", ip: "10.0.1.20"
end
64 changes: 64 additions & 0 deletions etc/manualTestEnv/multiReplica/topology.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
global:
user: tidb
deploy_dir: tidb-deploy
data_dir: tidb-data

server_configs:
tikv:
server.grpc-concurrency: 1
raftstore.apply-pool-size: 1
raftstore.store-pool-size: 1
readpool.unified.max-thread-count: 1
readpool.storage.use-unified-pool: false
readpool.coprocessor.use-unified-pool: true
storage.block-cache.capacity: 256MB
raftstore.capacity: 10GB
pd:
replication.location-labels:
- zone
- rack
- host

pd_servers:
- host: 10.0.1.20

tikv_servers:
- host: 10.0.1.20
port: 20160
status_port: 20180
config:
server.labels: { host: tikv1, rack: rack1 }
- host: 10.0.1.20
port: 20161
status_port: 20181
config:
server.labels: { host: tikv1, rack: rack1 }
- host: 10.0.1.20
port: 20162
status_port: 20182
config:
server.labels: { host: tikv2, rack: rack1 }
- host: 10.0.1.20
port: 20163
status_port: 20183
config:
server.labels: { host: tikv2, rack: rack1 }
- host: 10.0.1.20
port: 20164
status_port: 20184
config:
server.labels: { host: tikv3, rack: rack2 }
- host: 10.0.1.20
port: 20165
status_port: 20185
config:
server.labels: { host: tikv3, rack: rack2 }

tidb_servers:
- host: 10.0.1.20

grafana_servers:
- host: 10.0.1.20

monitoring_servers:
- host: 10.0.1.20
36 changes: 36 additions & 0 deletions etc/manualTestEnv/singleHost/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# singleHost

TiDB, PD, TiKV, TiFlash in the same host.

## Usage

1. Start the box:

```bash
vagrant up
```

1. Use [TiUP](https://tiup.io/) to deploy the cluster to the box (only need to do it once):

```bash
tiup cluster deploy singleHost v4.0.0 topology.yaml -i ../_shared/vagrant_key -y --user vagrant
```

1. Start the cluster in the box:

```bash
tiup cluster start singleHost
```

1. Start TiDB Dashboard server:

```bash
bin/tidb-dashboard --pd http://10.0.1.2:2379
```

## Cleanup

```bash
tiup cluster destroy singleHost -y
vagrant destroy --force
```
10 changes: 10 additions & 0 deletions etc/manualTestEnv/singleHost/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load "#{File.dirname(__FILE__)}/../_shared/Vagrantfile.partial.pubKey.ruby"

Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 3 * 1024
v.cpus = 2
end

config.vm.network "private_network", ip: "10.0.1.2"
end
37 changes: 37 additions & 0 deletions etc/manualTestEnv/singleHost/topology.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
global:
user: tidb
deploy_dir: tidb-deploy
data_dir: tidb-data

server_configs:
tikv:
server.grpc-concurrency: 1
raftstore.apply-pool-size: 1
raftstore.store-pool-size: 1
readpool.unified.max-thread-count: 1
readpool.storage.use-unified-pool: false
readpool.coprocessor.use-unified-pool: true
storage.block-cache.capacity: 256MB
pd:
replication.enable-placement-rules: true

pd_servers:
- host: 10.0.1.2

tikv_servers:
- host: 10.0.1.2

tidb_servers:
- host: 10.0.1.2

tiflash_servers:
- host: 10.0.1.2

grafana_servers:
- host: 10.0.1.2

monitoring_servers:
- host: 10.0.1.2

alertmanager_servers:
- host: 10.0.1.2
1 change: 1 addition & 0 deletions etc/manualTestEnv/singleHostMultiDisk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/
36 changes: 36 additions & 0 deletions etc/manualTestEnv/singleHostMultiDisk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# singleHostMultiDisk

All instances in a single host, but on different disks.

## Usage

1. Start the box:

```bash
vagrant up
```

1. Use [TiUP](https://tiup.io/) to deploy the cluster to the box (only need to do it once):

```bash
tiup cluster deploy singleHostMultiDisk v4.0.0 topology.yaml -i ../_shared/vagrant_key -y --user vagrant
```

1. Start the cluster in the box:

```bash
tiup cluster start singleHostMultiDisk
```

1. Start TiDB Dashboard server:

```bash
bin/tidb-dashboard --pd http://10.0.1.3:2379
```

## Cleanup

```bash
tiup cluster destroy singleHostMultiDisk -y
vagrant destroy --force
```
10 changes: 10 additions & 0 deletions etc/manualTestEnv/singleHostMultiDisk/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load "#{File.dirname(__FILE__)}/../_shared/Vagrantfile.partial.pubKey.ruby"

Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 3 * 1024
v.cpus = 2
end

config.vm.network "private_network", ip: "10.0.1.3"
end
Loading

0 comments on commit ca11e4d

Please sign in to comment.