{"id":19779076,"url":"https://github.com/rongfengliang/prisma-tidb","last_synced_at":"2026-04-28T12:32:24.237Z","repository":{"id":106173062,"uuid":"145570884","full_name":"rongfengliang/prisma-tidb","owner":"rongfengliang","description":"prisma-tidb","archived":false,"fork":false,"pushed_at":"2018-09-19T10:55:09.000Z","size":64,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-25T02:44:06.297Z","etag":null,"topics":["docker","docker-compose","graphql","prisma","tidb"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rongfengliang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-21T13:54:09.000Z","updated_at":"2019-07-20T02:13:16.000Z","dependencies_parsed_at":"2023-06-15T22:30:17.525Z","dependency_job_id":null,"html_url":"https://github.com/rongfengliang/prisma-tidb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rongfengliang/prisma-tidb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rongfengliang%2Fprisma-tidb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rongfengliang%2Fprisma-tidb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rongfengliang%2Fprisma-tidb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rongfengliang%2Fprisma-tidb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rongfengliang","download_url":"https://codeload.github.com/rongfengliang/prisma-tidb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rongfengliang%2Fprisma-tidb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32381345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","graphql","prisma","tidb"],"created_at":"2024-11-12T05:33:22.549Z","updated_at":"2026-04-28T12:32:24.219Z","avatar_url":"https://github.com/rongfengliang.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TiDB docker-compose \u0026\u0026 prisma\n\n\u003e add prisma run with tidb\n\n## How to Run\n\n```code\ndocker-compose up -d\nprisma deploy\n\nopen http://localhost:4466 for test graphql api\n\n```\n\n[![Build Status](https://travis-ci.org/pingcap/tidb-docker-compose.svg?branch=master)](https://travis-ci.org/pingcap/tidb-docker-compose)\n\n## Requirements\n\n* Docker \u003e= 17.03\n* Docker Compose \u003e= 1.6.0\n\n\u003e **Note:** [Legacy Docker Toolbox](https://docs.docker.com/toolbox/toolbox_install_mac/) users must migrate to [Docker for Mac](https://store.docker.com/editions/community/docker-ce-desktop-mac), since it is tested that tidb-docker-compose cannot be started on Docker Toolbox and Docker Machine.\n\n## Quick start\n\n```bash\n$ git clone https://github.com/pingcap/tidb-docker-compose.git\n$ cd tidb-docker-compose \u0026\u0026 docker-compose pull # Get the latest Docker images\n$ docker-compose up -d\n$ mysql -h 127.0.0.1 -P 4000 -u root\n```\n\n* Access monitor at http://localhost:3000\n\nDefault user/password: admin/admin\n\n* Access [tidb-vision](https://github.com/pingcap/tidb-vision) at http://localhost:8010\n\n* Access Spark Web UI at http://localhost:8080\n  and access [TiSpark](https://github.com/pingcap/tispark) through spark://127.0.0.1:7077\n\n## Customize TiDB Cluster\n\n### Configuration\n\n* config/pd.toml is copied from [PD repo](https://github.com/pingcap/pd/tree/master/conf)\n* config/tikv.toml is copied from [TiKV repo](https://github.com/pingcap/tikv/tree/master/etc)\n* config/tidb.toml is copied from [TiDB repo](https://github.com/pingcap/tidb/tree/master/config)\n\nIf you find these configuration files outdated or mismatch with TiDB version, you can copy these files from their upstream repos and change their metrics addr with `pushgateway:9091`. Also `max-open-files` are configured to `1024` in tikv.toml to simplify quick start on Linux, because setting up ulimit on Linux with docker is quite tedious.\n\nAnd config/*-dashboard.json are copied from [TiDB-Ansible repo](https://github.com/pingcap/tidb-ansible/tree/master/scripts)\n\nYou can customize TiDB cluster configuration by editing docker-compose.yml and the above config files if you know what you're doing.\n\nBut edit these files manually is tedious and error-prone, a template engine is strongly recommended. See the following steps\n\n### Install Helm\n\n[Helm](https://helm.sh) is used as a template render engine\n\n```\ncurl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash\n```\n\nOr if you use Mac, you can use homebrew to install Helm by `brew install kubernetes-helm`\n\n### Bring up TiDB cluster\n\n```bash\n$ git clone https://github.com/pingcap/tidb-docker-compose.git\n$ cd tidb-docker-compose\n$ vi compose/values.yaml # custom cluster size, docker image, port mapping etc\n$ helm template compose \u003e generated-docker-compose.yaml\n$ docker-compose -f generated-docker-compose.yaml pull # Get the latest Docker images\n$ docker-compose -f generated-docker-compose.yaml up -d\n```\n\nYou can build docker image yourself for development test.\n\n* Build from binary\n\n  For pd, tikv and tidb, comment their `image` and `buildPath` fields out. And then copy their binary files to pd/bin/pd-server, tikv/bin/tikv-server and tidb/bin/tidb-server.\n\n  These binary files can be built locally or downloaded from https://download.pingcap.org/tidb-latest-linux-amd64.tar.gz\n\n  For tidbVision, comment its `image` and `buildPath` fields out. And then copy tidb-vision repo to tidb-vision/tidb-vision.\n\n* Build from source\n\n  Leave pd, tikv, tidb and tidbVision `image` field empty and set their `buildPath` field to their source directory.\n\n  For example, if your local tikv source directory is $GOPATH/src/github.com/pingcap/tikv, just set tikv `buildPath` to `$GOPATH/src/github.com/pingcap/tikv`\n\n  *Note:* Compiling tikv from source consumes lots of memory, memory of Docker for Mac needs to be adjusted to greater than 6GB\n\n[tidb-vision](https://github.com/pingcap/tidb-vision) is a visiualization page of TiDB Cluster, it's WIP project and can be disabled by commenting `tidbVision` out.\n\n[TiSpark](https://github.com/pingcap/tispark) is a thin layer built for running Apache Spark on top of TiDB/TiKV to answer the complex OLAP queries.\n\n#### Host network mode (Linux)\n\n*Note:* Docker for Mac uses a Linux virtual machine, host network mode will not expose any services to host machine. So it's useless to use this mode.\n\nWhen using TiKV directly without TiDB, host network mode must be enabled. This way all services use host network without isolation. So you can access all services on the host machine.\n\nYou can enable this mode by setting `networkMode: host` in compose/values.yaml and regenerate docker-compose.yml. When in this mode, prometheus address in configuration files should be changed from `prometheus:9090` to `127.0.0.1:9090`, and pushgateway address should be changed from `pushgateway:9091` to `127.0.0.1:9091`.\n\nThese modification can be done by:\n```bash\n# Note: this only needed when networkMode is `host`\nsed -i 's/pushgateway:9091/127.0.0.1:9091/g' config/*\nsed -i 's/prometheus:9090/127.0.0.1:9090/g' config/*\n```\n\nAfter all the above is done, you can start tidb-cluster as usual by `docker-compose -f generated-docker-compose.yml up -d`\n\n### Debug TiDB/TiKV/PD instances\nPrerequisites:\n\nPprof: This is a tool for visualization and analysis of profiling data. Follow [these instructions](https://github.com/google/pprof#building-pprof) to install pprof.\n\nGraphviz: [http://www.graphviz.org/](http://www.graphviz.org/), used to generate graphic visualizations of profiles.\n\n* debug TiDB or PD instances\n\n```bash\n### Use the following command to starts a web server for graphic visualizations of golang program profiles\n$ ./tool/container_debug -s pd0 -p /pd-server -w\n```\nThe above command will produce graphic visualizations of profiles of `pd0` that can be accessed through the browser.\n\n* debug TiKV instances\n\n```bash\n### step 1: select a tikv instance(here is tikv0) and specify the binary path in container to enter debug container\n$ ./tool/container_debug -s tikv0 -p /tikv-server\n\n### after step 1, we can generate flame graph for tikv0 in debug container\n$ ./run_flamegraph.sh 1  # 1 is the tikv0's process id\n\n### also can fetch tikv0's stack informations with GDB in debug container\n$ gdb /tikv-server 1 -batch -ex \"thread apply all bt\" -ex \"info threads\"\n```\n\n### Access TiDB cluster\n\nTiDB uses ports: 4000(mysql) and 10080(status) by default\n\n```bash\n$ mysql -h 127.0.0.1 -P 4000 -u root\n```\n\nAnd Grafana uses port 3000 by default, so open your browser at http://localhost:3000 to view monitor dashboard\n\nIf you enabled tidb-vision, you can view it at http://localhost:8010\n\n### Access Spark shell and load TiSpark\n\nInsert some sample data to the TiDB cluster:\n\n```bash\n$ docker-compose exec tispark-master bash\n$ cd /opt/spark/data/tispark-sample-data\n$ mysql -h tidb -P 4000 -u root \u003c dss.ddl\n```\n\nAfter the sample data is loaded into the TiDB cluster, you can access Spark Shell by `docker-compose exec tispark-master /opt/spark/bin/spark-shell`.\n\n```bash\n$ docker-compose exec tispark-master /opt/spark/bin/spark-shell\n...\nSpark context available as 'sc' (master = local[*], app id = local-1527045927617).\nSpark session available as 'spark'.\nWelcome to\n      ____              __\n     / __/__  ___ _____/ /__\n    _\\ \\/ _ \\/ _ `/ __/  '_/\n   /___/ .__/\\_,_/_/ /_/\\_\\   version 2.1.1\n      /_/\n\nUsing Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_172)\nType in expressions to have them evaluated.\nType :help for more information.\n\nscala\u003e import org.apache.spark.sql.TiContext\n...\nscala\u003e val ti = new TiContext(spark)\n...\nscala\u003e ti.tidbMapDatabase(\"TPCH_001\")\n...\nscala\u003e spark.sql(\"select count(*) from lineitem\").show\n+--------+\n|count(1)|\n+--------+\n|   60175|\n+--------+\n```\n\nYou can also access Spark with Python or R using the following commands:\n\n```\ndocker-compose exec tispark-master /opt/spark/bin/pyspark\ndocker-compose exec tispark-master /opt/spark/bin/sparkR\n```\n\nMore documents about TiSpark can be found [here](https://github.com/pingcap/tispark).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frongfengliang%2Fprisma-tidb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frongfengliang%2Fprisma-tidb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frongfengliang%2Fprisma-tidb/lists"}