supperset docker安装

nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
stream {
upstream mysql {
hash $remote_addr consistent;
server rm-bp1q878cdwne8cyw9.mysql.rds.aliyuncs.com:3306 weight=5 max_fails=3 fail_timeout=30s;
}
server {
listen 33061;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass mysql;
}
upstream redis {
hash $remote_addr consistent;
server r-bp1du4rnml3f1inda1.redis.rds.aliyuncs.com:6379 weight=5 max_fails=3 fail_timeout=30s;
}
server {
listen 63791;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass redis;
}
}
1
2
3
netstat -tunlp
netstat -tunlp | grep 33061
netstat -tunlp | grep 63791
1
2
3
4
5
6
7
8
9
10
superset:
image: amancevice/superset
ports:
- "8088:8088"
deploy: *defailt-deploy
networks:
- *default-network
volumes:
- /etc/localtime:/etc/localtime
- /home/superset/data:/home/superset

查看容器id

1
docker container ls
1
2
3
4
5
6
docker exec -it 2ac1166aa13b superset fab create-admin \
--username admin \
--firstname Superset \
--lastname Admin \
--email admin@superset.com \
--password admin
1
docker exec -it 2ac1166aa13b superset db upgrade
1
docker exec -it 5cf314b17223 superset load_examples
1
docker exec -it 2ac1166aa13b superset init

界面配置mysql数据源

1
mysql+mysqldb://platform:bisuowei666@120.27.233.63:33061/business_station?chartset=utf8

配置myssql连接

1
2
3
4
pip download mysqlclient
pip install mysqlclient

mysql://platform:bisuowei666@127.0.0.1:3306/business_station?chartset=utf8
1
2
3
4
5
6
7
8
9
10
11
12
#折线图需要时间格式
select t.count,STR_TO_DATE(t.date,'%Y-%m-%d')dates from(
select count(id)as count,left(create_time,10) as date from yijiayou_user_order where order_state=1 GROUP by left(create_time,10)
)t order by t.date asc

#近一个月数据
select * from(
select t.count,CONCAT(t.date,'点') as dates from(
select *,substring(request_time,11,3)as date,count(id)as count from sys_app_page_log where DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(request_time)
GROUP by substring(request_time,11,3)
)t group by t.date order by t.date desc
)tt order by tt.dates asc
1
2
折线图要在自定义里面选择时间格式化类型
饼状图要选择group by 字段
1
2
3
4
#看板权限
can userinfo
can dashboards
can datasource

https://www.cnblogs.com/vickey-wu/p/10205031.html

https://superset.incubator.apache.org/docs/installation/configuring-superset

https://github.com/apache/incubator-superset/tree/master/docker

-------------本文结束-------------
0%