tidbstandalone/start.sh

51 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "🚀 Starting TiDB Local Environment..."
# Check if .env exists
if [ ! -f .env ]; then
echo "⚠️ .env file not found!"
echo "📝 Creating .env from template..."
cp .env.example .env
echo "✏️ Please edit .env file with your test database credentials"
echo " Then run this script again."
exit 1
fi
# Source .env to check if configured
source .env
if [ "$TEST_DB_HOST" = "your-test-tidb-host" ]; then
echo "⚠️ .env file needs configuration!"
echo "✏️ Please edit .env file with your test database credentials"
exit 1
fi
echo "🐳 Starting Docker containers..."
docker compose up -d
echo ""
echo "⏳ Waiting for services to be ready..."
sleep 10
echo ""
echo "✅ Environment started successfully!"
echo ""
echo "📊 Connection Info:"
echo " TiDB: mysql -h 127.0.0.1 -P 4000 -u root"
echo " DataGrip: Host: 127.0.0.1, Port: 4000, User: root, Password: (empty)"
echo ""
echo "🔄 To sync data from TiDB Cloud:"
echo " ./sync-data.sh"
echo ""
echo "🔍 Useful commands:"
echo " Test connection: ./test-connection.sh"
echo " Sync data: ./sync-data.sh"
echo " View logs: docker compose logs -f"
echo " Stop environment: docker compose down"
echo ""
echo "📖 For DataGrip setup: see DATAGRIP_SETUP.md"
echo "📘 For TiDB Cloud migration: see TIDB_CLOUD_MIGRATION.md"
echo ""