Skip to content

Instantly share code, notes, and snippets.

View c4pt0r's full-sized avatar

dongxu c4pt0r

View GitHub Profile

Install TiUP

$ curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh

Start a TiDB Cluster

$ tiup playground
@c4pt0r
c4pt0r / How
Last active February 25, 2024 14:33
Build your own Dropbox using TiDB Cloud Free Tier + JuiceFS + AWS S3 in 2 lines.
1. Open S3 service in AWS, create bucket and get the access point, like this: https://${bucket-name}.s3.us-west-2.amazonaws.com
2. Go to https://tidbcloud.com and register a new free TiDB instance (10G), get a MySQL endpoint, and make sure the traffic filter is properly configured to allow public access.
3. Install the juicefs client locally in Distributed Mode (https://juicefs.com/docs/community/getting-started/for_distributed)
4. initialize and mount FUSE according to the following two lines:
# juicefs format --storage s3 \
--bucket https://${bucket-name}.s3.us-west-2.amazonaws.com \
--access-key ${aws-access-key} \
--secret-key ${aws-secret} \
mysql://${mysql-user}:${mysql-password}@\(your-cloud-tidb.prod.aws.tidbcloud.com:4000\)/juice \
#!/usr/bin/env python3
import time
import slack
import os
import sqlite3
from requests_html import HTMLSession
client = slack.WebClient(os.environ.get('SLACK_BOT_TOKEN'))
session = HTMLSession()
@c4pt0r
c4pt0r / index.html
Last active February 26, 2020 10:50
tiup index.html
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://cdn.bootcss.com/mini.css/3.0.1/mini-dark.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8" />
<title>TiUP</title>
</head>
@c4pt0r
c4pt0r / result
Created May 26, 2019 22:57
TiDB vs Aurora on TPCH10
TiDB Aurora With FK Aurora Without FK
Q1 15.28 144 144.13
Q2 4.09 4.18 4.21
Q3 4.93 20.59 34.18
Q4 2.3 7.5 7.49
Q5 19.44 18.25 22.43
Q6 5.96 21.74 21.94
Q7 8.42 12.06 81.83
Q8 3.49 41.7 53.99
Q9 34.71 33.7 442.26
@c4pt0r
c4pt0r / tpcc.conf
Created May 26, 2019 21:46
tpcc configuration for TiDB
db=mysql
driver=com.mysql.jdbc.Driver
conn=jdbc:mysql://0.0.0.0:6000/tpcc?useSSL=false&useServerPrepStmts=true&useConfigs=maxPerformance&rewriteBatchedStatements=false&callableStmtCacheSize=1000&prepStmtCacheSize=1000&sessionVariables=tidb_batch_commit=1
user=root
password=
warehouses=1000
loadWorkers=32
terminals=500
@c4pt0r
c4pt0r / tikv.toml.patch
Created May 26, 2019 17:06
tikv config for sysbench
diff --git a/conf/tidb.yml b/conf/tidb.yml
index d7e1d23..6e15aab 100644
--- a/conf/tidb.yml
+++ b/conf/tidb.yml
@@ -42,7 +42,7 @@ global:
log:
# Log level: debug, info, warn, error, fatal.
- # level: "info"
+ level: "error"
@c4pt0r
c4pt0r / task-aurora.yaml
Created May 16, 2019 03:51
task-aurora.yaml
name: test
task-mode: all
is-sharding: false
meta-schema: "dm_meta"
remove-meta: false
enable-heartbeat: false
ignore-checking-items: ["dump_privilege", "replication_privilege"]
target-database:
host: ""
{
"comment": "",
"ignore": "test",
"package": [
{
"checksumSHA1": "2sLgks1Fi3Dek1svURoHiI95gAw=",
"origin": "github.com/pingcap/tidb/vendor/github.com/BurntSushi/toml",
"path": "github.com/BurntSushi/toml",
"revision": "418cdf2308c8ebedadbf356142f9afbab9aea111",
"revisionTime": "2018-09-03T23:56:42Z"
@c4pt0r
c4pt0r / benchseek.go
Last active January 10, 2018 07:21
A simple demo of TiKV's prefix seek API
// A simple demo of TiKV's prefix seek API
/*
$./benchseek
INFO[0000] [pd] create pd client with endpoints [localhost:2379]
INFO[0000] [pd] leader switches to: http://127.0.0.1:2379, previous:
INFO[0000] [pd] init cluster id 6508961674812833664
hello_1
hello_2
hello_3