一福青、安裝
從https://github.com/getredash/redash, 拉取代碼偷拔,運(yùn)行docker-compose.production.yml
1养匈,docker-compose文件調(diào)整
主要修改了兩處:
1秋度,增加了redis和postgres的db文件與宿主機(jī)的映射,不讓docker容器停止后數(shù)據(jù)丟失惯疙。
官方默認(rèn)的docker-compose.production.yml在docker-compose down 命令后翠勉,所有的配置信息都丟失了
2,增加了redis和postgres的端口映射霉颠,方便調(diào)試对碌,線上環(huán)境也可以關(guān)掉。
3蒿偎,修改REDASH_COOKIE_SECRET朽们。
修改后的docker-compose.yml文件如下:
# 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:latest # 官方版本升級(jí)后不好用了怀读,替換為我保持的版本
image: cbbing/redash:4.0.1
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: "Q422k6vaXUk8"
REDASH_WEB_WORKERS: 4
restart: always
worker:
image: cbbing/redash:4.0.1
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"
depends_on:
- server
links:
- server:redash
restart: always
2,創(chuàng)建db
[root@VM_38_115_centos redash]# docker-compose run --rm server create_db
Starting redash_redis_1
Starting redash_postgres_1
[2018-09-11 09:02:39,580][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2018-09-11 09:02:39,601][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
[2018-09-11 09:02:41,707][PID:1][INFO][alembic.runtime.migration] Context impl PostgresqlImpl.
[2018-09-11 09:02:41,708][PID:1][INFO][alembic.runtime.migration] Will assume transactional DDL.
[2018-09-11 09:02:41,724][PID:1][INFO][alembic.runtime.migration] Running stamp_revision -> 969126bd800f
3骑脱,運(yùn)行
# docker-compose up
運(yùn)行起來的容器如下:
運(yùn)行起來后通過88端口訪問
4菜枷,郵件配置
For the system to be able to send emails (for example when alerts trigger), you need to set the mail server to use and the host name of your Redash server. If you’re using one of our images, you can do this by editing the .env file:
# Note that not all values are required, as they have default values.
export REDASH_MAIL_SERVER="" # default: localhost
export REDASH_MAIL_PORT="" # default: 25
export REDASH_MAIL_USE_TLS="" # default: false
export REDASH_MAIL_USE_SSL="" # default: false
export REDASH_MAIL_USERNAME="" # default: None
export REDASH_MAIL_PASSWORD="" # default: None
export REDASH_MAIL_DEFAULT_SENDER="" # Email address to send from
export REDASH_HOST="" # base address of your Redash instance, for example: "https://demo.redash.io"
docker-compose文件中配置
server:
image: redash/redash:latest
environment:
...
#郵箱
REDASH_MAIL_SERVER: "smtp.exmail.qq.com"
REDASH_MAIL_PORT: 465
REDASH_MAIL_USE_TLS: "false"
REDASH_MAIL_USE_SSL: "true"
REDASH_MAIL_USERNAME: "no-reply@yoursite.com"
REDASH_MAIL_PASSWORD: "111111"
REDASH_MAIL_DEFAULT_SENDER: "no-reply@yoursite.com"
REDASH_HOST: "http://redash.mysite.com"
測(cè)試是否配置成功:
[root@VM_38_115_centos ~]# docker exec -it redash_server_1 python manage.py send_test_mail
[2018-09-11 10:02:28,627][PID:37][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2018-09-11 10:02:28,649][PID:37][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
自己郵件會(huì)收到Test message。
PS:配置成功了惜姐,但在Alerts中觸發(fā)了警告犁跪,設(shè)置的接受郵件沒收到警告信息椿息。還沒找到原因...
二歹袁、使用
1,配置數(shù)據(jù)庫(kù)
2寝优,查詢語句
-
獲取表的更新時(shí)間
增加圖表展示:
3条舔,Dashboards
三、用戶管理
添加用戶
四乏矾、特性
1孟抗,支持iframe嵌入到其它網(wǎng)頁
對(duì)于任何Query,表格和圖形都支持embed
點(diǎn)擊Embed彈出:
這個(gè)功能可以實(shí)現(xiàn)自己系統(tǒng)中集成報(bào)表展示钻心。
2凄硼,可視化圖形支持的類型
箱型圖
線形圖、柱狀圖捷沸、面積圖摊沉、餅圖、散點(diǎn)圖
隊(duì)列圖
計(jì)數(shù)器
漏斗圖
地圖
透視表
裳鞲基圖
伤的基圖用于表達(dá)流量分布于結(jié)構(gòu)對(duì)比,最初的發(fā)明者使用它來呈現(xiàn)能量的流動(dòng)與分布苍柏。
旭日?qǐng)D(Sunburst)
詞云圖
五尼斧,實(shí)踐
根據(jù)scrapy log日志表,設(shè)計(jì)出一張bashboard監(jiān)控面板: