# Metabase — Open Source Business Intelligence & Analytics > Metabase lets everyone in your organization ask questions and learn from data. Connect any database, build dashboards, and share insights — no SQL knowledge required. ## Install Save in your project root: ## Quick Use ```bash docker run -d --name metabase -p 3000:3000 metabase/metabase:latest ``` Open `http://localhost:3000` — connect your database and start building dashboards. ## Intro **Metabase** is the easiest way to let everyone in your company work with data. It provides a beautiful web interface where anyone can ask questions about your database data, build interactive dashboards, and share insights — without writing SQL (though SQL is supported for power users). With 46.8K+ GitHub stars, Metabase is the most popular open-source BI tool, used by over 60,000 organizations worldwide from startups to Fortune 500 companies. ## What Metabase Does - **Visual Query Builder**: Click-based interface to ask questions without SQL - **SQL Editor**: Full SQL editor with autocomplete for advanced users - **Dashboards**: Interactive dashboards with filters, drill-down, and auto-refresh - **Charts**: 15+ visualization types (bar, line, pie, map, funnel, pivot table, etc.) - **Alerts**: Automated alerts when metrics cross thresholds - **Embedding**: Embed charts and dashboards into your own application - **Data Modeling**: Define metrics, segments, and relationships in a metadata layer - **Permissions**: Granular access control by group, database, table, and column - **Collections**: Organize dashboards and questions into shareable collections ## Architecture ``` ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ Browser │────▶│ Metabase │────▶│ Your Data │ │ (Dashboard) │ │ Server │ │ PostgreSQL │ └──────────────┘ │ (Java/Clj) │ │ MySQL │ └──────────────┘ │ BigQuery │ │ Snowflake │ │ Redshift │ │ MongoDB │ └──────────────┘ ``` ## Self-Hosting ### Docker Compose (Production) ```yaml services: metabase: image: metabase/metabase:latest ports: - "3000:3000" environment: MB_DB_TYPE: postgres MB_DB_HOST: metabase-db MB_DB_PORT: 5432 MB_DB_DBNAME: metabase MB_DB_USER: metabase MB_DB_PASS: metabase depends_on: - metabase-db metabase-db: image: postgres:16-alpine environment: POSTGRES_USER: metabase POSTGRES_PASSWORD: metabase POSTGRES_DB: metabase volumes: - mb-db:/var/lib/postgresql/data volumes: mb-db: ``` ## Supported Data Sources | Category | Databases | |----------|-----------| | SQL | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite | | Cloud DW | BigQuery, Snowflake, Redshift, Databricks | | NoSQL | MongoDB | | Analytics | ClickHouse, Druid, Presto/Trino, Spark SQL | | Flat Files | CSV uploads | | APIs | Google Analytics, Stitch, custom drivers | ## Key Features ### Visual Query Builder No SQL required: ``` Table: Orders ├── Filter: Created At is in the last 30 days ├── Summarize: Sum of Total, grouped by Product Category ├── Sort: Total descending └── Visualization: Bar Chart ``` This generates SQL behind the scenes: ```sql SELECT product_category, SUM(total) FROM orders WHERE created_at >= CURRENT_DATE - INTERVAL '30 days' GROUP BY product_category ORDER BY SUM(total) DESC ``` ### Dashboard Filters ``` Dashboard: Sales Overview ├── Date Filter: Last 30 days / This quarter / Custom range ├── Region Filter: Dropdown (North, South, East, West) ├── Product Filter: Search + multi-select └── All charts update based on filter selections ``` ### Embedding Embed Metabase in your own app: ```javascript // iframe embedding const iframeUrl = "http://metabase:3000/embed/dashboard/eyJ..." // JWT-signed embedding (secure) const jwt = require('jsonwebtoken'); const METABASE_SECRET = "your-secret-key"; const payload = { resource: { dashboard: 1 }, params: { customer_id: currentUser.id }, exp: Math.round(Date.now() / 1000) + (10 * 60), }; const token = jwt.sign(payload, METABASE_SECRET); const embedUrl = `http://metabase:3000/embed/dashboard/${token}`; ``` ### Alerts & Subscriptions ``` Alert: When daily revenue drops below $10,000 → Send Slack notification to #revenue channel → Email CFO Subscription: Weekly sales report → Every Monday 8am → Email to sales-team@company.com → Include dashboard as PDF attachment ``` ## Metabase vs Alternatives | Feature | Metabase | Redash | Grafana | Looker | Tableau | |---------|----------|--------|---------|--------|---------| | Open Source | Yes | Yes (BSD) | Yes (AGPL) | No | No | | No-SQL queries | Visual builder | SQL only | PromQL | LookML | Drag & drop | | Ease of use | Very easy | Moderate | Moderate | Complex | Moderate | | Embedding | Yes | Limited | Yes | Yes | Yes | | Self-hosted | Yes | Yes | Yes | No | Enterprise | | Pricing | Free (OSS) | Free | Free | $5K+/mo | $70/user/mo | ## 常见问题 **Q: Metabase 适合什么规模的团队?** A: 从个人到数千人的组织都适用。开源版没有用户数限制。对于大型企业,Metabase Pro/Enterprise 提供缓存、审计、SAML SSO 等高级功能。 **Q: 查询会影响生产数据库性能吗?** A: Metabase 建议连接只读副本(read replica)而非直接查询生产库。也可以配置查询超时和并发限制来保护数据库。 **Q: 可以连接多个数据库吗?** A: 可以。一个 Metabase 实例可以连接多个不同类型的数据库,在同一个仪表盘中展示来自不同数据源的数据。 ## 来源与致谢 - GitHub: [metabase/metabase](https://github.com/metabase/metabase) — 46.8K+ ⭐ - 官网: [metabase.com](https://metabase.com) --- Source: https://tokrepo.com/en/workflows/a1cd7314-34d0-11f1-9bc6-00163e2b0d79 Author: AI Open Source