pdctl is a command line tool for pd
- Make sure Go (version 1.5+) is installed.
- Use
make
in pd root path.pdctl
will build inbin
directory.
run:
./pd-ctl store -d -u 127.0.0.1:2379
show all stores status. '-u' specify the pd address, it can be overwritten by setting the environment variable PD_ADDR. Such as export PD_ADDR=127.0.0.1:2379
- The pd address
- default: http://127.0.0.1:2379
- env variable: PD_ADDR
- Run pdctl without readline
- default: false
show the store status or delete a store
>> store
{
"count": 3,
"stores": [...]
}
>> store 1
......
>> store delete 1
......
show or set the balance config
>> config show
{
"min-region-count": 10,
"min-leader-count": 10,
"max-snapshot-count": 3,
"min-balance-diff-ratio": 0.01,
"max-store-down-duration": "30m0s",
"leader-schedule-limit": 8,
"leader-schedule-interval": "10s",
"storage-schedule-limit": 4,
"storage-schedule-interval": "30s"
}
>> config set leader-schedule-interval 20s
Success!
show the pd members status
>> member
{
"members": [......]
}
>> member leader
{
"name": "pd",
"addr": "http://192.168.199.229:2379",
"id": 9724873857558226554
}
>> member delete name pd2
Success!
show one or all regions status
>> region
{
"count": 1,
"regions": [......]
}
>> region 2
{
"region": {
"id": 2,
......
}
"leader": {
......
}
}