Skip to content

Instantly share code, notes, and snippets.

@gregwebs
Created April 16, 2021 02:40
Show Gist options
  • Save gregwebs/b5c1e6871b99a7dd7ee613627a48786b to your computer and use it in GitHub Desktop.
Save gregwebs/b5c1e6871b99a7dd7ee613627a48786b to your computer and use it in GitHub Desktop.
# This is as Justfile: https://github.com/casey/just#readme
tiup:
TZ=UTC tiup playground --db 1 --kv 1 --pd 1
tidb-erase-data:
rm -r ~/tidb/tikv/data
rm -r ~/go/src/github.com/tikv/pd/data
aws-local +args:
@env DOCKER_TERM_ARGS="--network=host" AWS_PROFILE=localstack AWS_VAULT=OFF AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test {{args}}
tikv +args='':
#!/usr/bin/env bash
set -euo pipefail
cd "$HOME/tidb/tikv"
./target/debug/tikv-server --pd-endpoints="127.0.0.1:2379" --addr="127.0.0.1:20160" --data-dir=./data --config ../workflows/config/enc.toml {{args}} 2>&1 | tee log.txt
tikv-backtrace:
tail -1000 log.txt | grep backtrace | python -c "import sys; map(lambda a: sys.stdout.write(a.decode('string_escape')), sys.stdin)"
pd +args='':
#!/usr/bin/env bash
set -euo pipefail
cd "$HOME/go/src/github.com/tikv/pd"
test -f ./bin/pd-server || make
./bin/pd-server --name=pd1 --data-dir="./data" --client-urls="http://127.0.0.1:2379" --peer-urls="http://127.0.0.1:2380" --initial-cluster="pd1=http://127.0.0.1:2380" --advertise-client-urls=http://127.0.0.1:2379 {{args}}
tidb +args='':
#!/usr/bin/env bash
set -euo pipefail
cd "$HOME/go/src/github.com/pingcap/tidb"
test -f ./bin/tidb-server || make
TZ=UTC ./bin/tidb-server --path="$(pwd)/data" -store tikv -path=localhost:2379 {{args}}
bench:
$GOPATH/src/github.com/pingcap/go-ycsb/bin/go-ycsb run tikv \
-P $GOPATH/src/github.com/pingcap/go-ycsb/workloads/workloadc \
-p verbose=false -p debug.pprof=":6060" \
-p tikv.pd="127.0.0.1:2379" -p tikv.type="raw" \
-p operationcount=100000 -p recordcount=100000 \
-p threadcount=500
br-s3-local bucket +args='':
AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test ~/go/src/github.com/pingcap/br/bin/br -s s3://{{bucket}} --s3.endpoint http://localhost:4566 --s3.provider aws --s3.region us-west-2 {{args}}
GCS_ENDPOINT := "http://storage.gcs.127.0.0.1.nip.io:4443/storage/v1/"
# GCS_ENDPOINT := http://localhost:4443/storage/v1
backup-gcs-local +args:
~/go/src/github.com/pingcap/br/bin/br --gcs.endpoint {{GCS_ENDPOINT}} --no-credentials --send-credentials-to-tikv=false --skip-check-path backup -s gcs://backup/{{args}}
restore-gcs-local +args:
~/go/src/github.com/pingcap/br/bin/br --gcs.endpoint {{GCS_ENDPOINT}} --no-credentials --send-credentials-to-tikv=false restore -s gcs://backup/{{args}}
scli-local:
AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test ./target/debug/examples/scli --storage S3 --endpoint http://localhost:4566 --region us-west-2 --bucket backup --name scli --path . --file ./target/debug/examples/scli save
aws-cli-local +args='':
AWS_VAULT=1 AWS_PROFILE=localstack aws --endpoint http://localhost:4566 {{args}}
external-storage-service:
#!/usr/bin/env bash
set -euo pipefail
cd "$HOME/tidb/tikv"
./scripts/env cargo build -p external_storage_export --features=protobuf-codec,cloud-gcp,cloud-aws,cloud-storage-grpc
RUST_BACKTRACE=1 RUST_LIB_BACKTRACE=1 ./target/debug/tikv-cloud-storage
localstack:
#!/usr/bin/env bash
set -euo pipefail
cd "$HOME/code/localstack"
docker-compose up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment