Redash详细部署教程
1、安装Docker-CE
1.1、安装步骤
Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。
Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。
1 | 检测Linux版本 命令:uname -r |
1.2、卸载Docker-CE
1 | sudo yum remove docker-ce |
注:移除旧版本Docker
1 | sudo yum remove docker \ |
1.3、镜像加速
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们可以需要配置加速器来解决,我使用的是网易的镜像地址:http://hub-mirror.c.163.com。(或者使用其他的镜像)
新版的 Docker 使用 /etc/docker/daemon.json(Linux) 或者 %programdata%\docker\config\daemon.json(Windows) 来配置 Daemon。
请在该配置文件中加入(没有该文件的话,请先建一个):
1 | { |
1.4、常见错误
不能正常使用命令,报错信息如下
1
2
3Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
解决:检测Docker服务是否启动,是否需要超级管理员权限
2、安装Docker-compose
- 安装方式(二进制文件)
1 | 下载最新版的docker-compose文件 github地址:https://github.com/docker/compose/releases |
删除方式
1
2直接删除二进制文件
sudo rm -rf /usr/local/bin/docker-compose注:另一种方式请自行百度,这里不做过多介绍
3、安装Redash
Redash介绍
此处省略一万字
安装过程
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从GitHub下载源码
git clone https://github.com/getredash/redash.git
进入redash目录
cd redash
创建docker-compose.production.yml文件,内容参考yml配置
touch docker-compose.production.yml
创建db
docker-compose -f docker-compose.production.yml run --rm server create_db
Starting redash_redis_1
Starting redash_postgres_1
[2019-06-11 09:02:39,580][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2019-06-11 09:02:39,601][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
[2019-06-11 09:02:41,707][PID:1][INFO][alembic.runtime.migration] Context impl PostgresqlImpl.
[2019-06-11 09:02:41,708][PID:1][INFO][alembic.runtime.migration] Will assume transactional DDL.
[2019-06-11 09:02:41,724][PID:1][INFO][alembic.runtime.migration] Running stamp_revision -> 969126bd800f
redash运行
docker-compose -f docker-compose.production.yml up
redash运行后台运行
docker-compose -f docker-compose.production.yml up -d
如果配置邮箱预警可用以下命令检测 可以接受到邮件,如有问题可检测你的邮件配置
docker exec -it redash_server_1 python manage.py send_test_mail
docker-compose.production.yml
(注意用yml的编写格式)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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69# This is an example configuration for Docker Compose. Make sure to atleast update
# the cookie secret & postgres database password.
#
# Some other recommendations:
# 1. To persist Postgres data, assign it a volume host location.
# 2. Split the worker service to adhoc workers and scheduled queries workers.
version: '2'
services:
server:
image: redash/redash:6.0.0.b8537
command: server
depends_on:
- postgres
- redis
ports:
- "5000:5000"
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
REDASH_COOKIE_SECRET: "yongzheng"
REDASH_WEB_WORKERS: 4
#邮箱
REDASH_MAIL_SERVER: "smtp.exmail.qq.com"
REDASH_MAIL_PORT: 465
REDASH_MAIL_USE_TLS: "true"
REDASH_MAIL_USE_SSL: "true"
REDASH_MAIL_USERNAME: "yongzheng@qq.com"
REDASH_MAIL_PASSWORD: "yongzheng"
REDASH_MAIL_DEFAULT_SENDER: "yongzheng@qq.com"
REDASH_HOST: "http://192.168.3.110:88"
restart: always
worker:
image: redash/redash:6.0.0.b8537
command: scheduler
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
QUEUES: "queries,scheduled_queries,celery"
WORKERS_COUNT: 2
restart: always
redis:
image: redis:3.0-alpine
ports:
- "6379:6379"
volumes:
- ./data/redis_data:/data
restart: always
postgres:
image: postgres:9.5.6-alpine
ports:
- "5432:5432"
volumes:
- ./data/postgresql_data:/var/lib/postgresql/data
restart: always
nginx:
image: redash/nginx:latest
ports:
- "88:80"
volumes:
- ./data/nginx:/etc/nginx
#depends_on:
# - server
links:
- server:redash
restart: always注:Redash的版本请勿使用latest,否则则会query查询不出。
网上很多教程都是使用latest版本,但是文章写得
4、使用介绍
使用请自行找度娘