本地部署
- 虚拟机
- 工具:vmware创建linux centos 7 64位虚拟机
- 硬件:1核1G20G(多文件),桥接
- 安装:CentOS-7-x86_64-Minimal-2009.iso,192.168.1.88,root 四个空格
- Metabase
- docker-compose.yml
services: metabase: container_name: metabase image: metabase/metabase restart: always # H2数据库上次不安全关闭,导致服务器重启不会执行unless-stopped的自动运行,改为always environment: # - MB_DB_FILE=/metabase-data/metabase.db - MB_DB_TYPE=mysql # 使用MySQL - MB_DB_DBNAME=metabase # 数据库名 - MB_DB_PORT=3306 - MB_DB_USER=at - MB_DB_PASS=at_password_sdf234j265 - MB_DB_HOST=mysql # MySQL容器名称 - JAVA_OPTS="-Xmx512m -Xms256m" # 设置JVM内存 volumes: - ./data:/metabase-data networks: - ghost_net networks: ghost_net: external: true
- Nginx
- nginx/conf.d/metabase.conf,通过vi的:set paste后粘贴(格式全乱,注释混乱的解决)
# Metabase Nginx Configuration # Redirect all HTTP traffic to HTTPS server { listen 80; server_name metabase.atibmlocal.com; # Serve ads.txt for Google AdSense location /ads.txt { alias /usr/share/nginx/html/metabase/ads.txt; } # Serve robots.txt for search engines location /robots.txt { alias /usr/share/nginx/html/metabase/robots.txt; } # Redirect all other requests to HTTPS return 301 https://$host$request_uri; } # HTTPS server configuration server { listen 443 ssl; server_name metabase.atibmlocal.com; # SSL certificate configuration ssl_certificate /etc/letsencrypt/live/ghost.atibm.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/ghost.atibm.com/privkey.pem; # Logging configuration access_log /var/log/nginx/metabase-access.log; error_log /var/log/nginx/metabase-error.log; # Serve ads.txt for Google AdSense location /ads.txt { alias /usr/share/nginx/html/metabase/ads.txt; } # Serve robots.txt for search engines location /robots.txt { alias /usr/share/nginx/html/metabase/robots.txt; } # Main application proxy location / { # Proxy configuration proxy_pass http://metabase:3000; proxy_http_version 1.1; # Header configuration proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Timeout settings proxy_connect_timeout 150s; proxy_send_timeout 100s; proxy_read_timeout 100s; # Buffer settings proxy_buffers 4 32k; # Client body settings client_max_body_size 10m; client_body_buffer_size 128k; } }
- 访问web
- 本地host配置域名指向nginx所在IP
- 访问metabase,并完成初始化设置
生产部署
企业报告事例
- 数据源sqlite
- 创建空db:宿主机[ghost@VMCentos7 data]$ sqlite3 kaicong.db "VACUUM;"
- 加入数据源:metabase添加数据库选sqlite类型,地址/metabase-data/kaicong.db
- 数据维护:需要sqlite工具操作db文件
- 数据图表:metabase可以写sql查询统计输出
- 数据源mysql
- 数据源csv
- 上传功能未开通:需要设置,并选中一个数据库才行
- 不支持的文件类型: