0%

使用Docker快速搭建Redash服务

Redash是一款开源的BI工具,提供了基于web的数据库查询和数据可视化功能。

快速启动

配置docker-compose.yaml文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
version: '2'
x-redash-service: &redash-service
image: redash/redash
depends_on:
- postgres
- redis
env_file: ./env
restart: always
services:
server:
<<: *redash-service
command: server
ports:
- 5000:5000
environment:
REDASH_WEB_WORKERS: 4
scheduler:
<<: *redash-service
command: scheduler
environment:
QUEUES: "celery"
WORKERS_COUNT: 1
scheduled_worker:
<<: *redash-service
command: worker
environment:
QUEUES: "scheduled_queries,schemas"
WORKERS_COUNT: 1
adhoc_worker:
<<: *redash-service
command: worker
environment:
QUEUES: "queries"
WORKERS_COUNT: 2
postgres:
image: postgres:9.6-alpine
env_file: ./env
volumes:
- ./postgres-data:/var/lib/postgresql/data
restart: always
redis:
image: redis
restart: always

配置env环境变量文件

1
2
3
4
5
6
7
PYTHONUNBUFFERED=0
REDASH_LOG_LEVEL=INFO
REDASH_REDIS_URL=redis://redis:6379/0
POSTGRES_PASSWORD=${postgres_password}
REDASH_COOKIE_SECRET=${redash_cookie_secret}
REDASH_SECRET_KEY=${redash_secret_key}
REDASH_DATABASE_URL=postgresql://postgres:${postgres_password}@postgres/postgres

更多设置参考:env-vars-settings

启动服务

1
2
3
4
# 初始化数据库
docker-compose run --rm server create_db
# 启动服务
docker-compose up -d