This repository provides the necessary configurations and files to set up a TiDB cluster on a single machine for testing or development purposes.
.
├── config
│ ├── dashboards
│ ├── grafana
│ ├── placement-driver
│ ├── prometheus
│ ├── tidb
│ ├── tiflash
│ └── tikv
├── data
├── docker-compose.yml
├── logs
└── README.md
config/
: Configuration files for Grafana, Prometheus, TiDB, TiKV, TiFlash and Placement Driver.data/
: Contains runtime data for Grafana, Prometheus, and TiKV, PD, TiFlashlogs/
: Logs for all components in the TiDB cluster.
Before setting up the TiDB cluster, ensure the following are installed on your machine:
- Docker
- Docker Compose
- At least 8 CPU cores and 16GB RAM for optimal performance
git clone https://github.com/haiphamcoder/tidb-single-machine.git
cd tidb-single-machine
Review and modify configuration files under the config/
directory if necessary.
Use Docker Compose to bring up the cluster:
docker compose up -d
- Grafana:
http://localhost:3000
- Prometheus:
http://localhost:9090
- TiDB: Connect using a MySQL client at
127.0.0.1:4000
To stop the cluster, run:
docker compose down
Grafana dashboards are pre-configured for TiDB monitoring. They are located in:
config/grafana/provisioning/dashboards/
- Overview:
overview.json
- Placement Driver:
pd.json
- TiDB:
tidb.json
- TiKV Pull:
tikv_pull.json
-
Docker Container Fails to Start:
- Check logs in the
logs/
directory for detailed error messages.
- Check logs in the
-
High Resource Usage:
- Ensure your machine meets the recommended resource requirements.
Component logs are available in the logs/
directory for troubleshooting:
placement-driver-server-*.log
tidb.log
tikv-server-*.log
tiflash-server-*.log
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to submit issues or pull requests to improve this repository!