公司希望也开发一套多维分析系统,以解决运营/产品无休止的需求和技术人力不足的矛盾!
一、开发选型:
一、BIRT:易用性差,所以没再使用
二、JasperReport+ireport:文档收费,不支持ETL工具
三、Pentaho:在中国比较普及,文档多,报表是其中的一部分,比如数据同步和ETL也都有
四、Openi:老牌BI工具,以前淘宝等公司都使用过,可惜过时啦
结合公司实际,综合考虑决定使用Pentaho的saiku做为报表平台
二、搭建环境:
选型结束后,就开始准备,搭建环境!
方案一、下载源代码,编译安装
git地址:https://github.com/OSBI/saiku
clone下来之后,按照ReadMe安装,可是各种jar包找不到(尝试*和多种版本)没有解决问题之后放弃了,下面是报错的信息(如果哪位高手解决了下面的问题,望不吝赐教):
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Saiku Module Project ............................... SUCCESS [ 15.192 s]
[INFO] saiku - core libraries ............................. SUCCESS [ 8.457 s]
[INFO] saiku olap util .................................... SUCCESS [09:05 min]
[INFO] saiku - services ................................... FAILURE [25:41 min]
[INFO] saiku - web ........................................ SKIPPED
[INFO] saiku-ui ........................................... SKIPPED
[INFO] saiku - webapp ..................................... SKIPPED
[INFO] saiku-server ....................................... SKIPPED
[INFO] saiku biserver plugin .............................. SKIPPED
[INFO] saiku biserver plugin .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35:21 min
[INFO] Finished at: 2016-02-04T21:22:34+08:00
[INFO] Final Memory: 35M/145M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project saiku-service: Could not resolve dependencies for project org.saikuanalytics:saiku-service:jar:3.7.4: Failed to collect dependencies at org.saiku:saiku-query:jar:0.1-SNAPSHOT -> pentaho:mondrian:jar:4.3.0.1-SPARK: Failed to read artifact descriptor for pentaho:mondrian:jar:4.3.0.1-SPARK: Could not transfer artifact pentaho:mondrian:pom:4.3.0.1-SPARK from/to atlassian2 (http://repository.opencastproject.org/): repository.opencastproject.org:80 failed to respond -> [Help 1]
方案二、直接安装
- 下载源代码:http://community.meteorite.bi/
- 解压:saiku-latest.zip(版本是saiku 3.7 Released)
- 启动:我使用的是OSX系统,所以直接运行脚本:start-saiku.sh
- 查看结果:
三、配置
1、填写schema
选择Admin Console,再选择Add Schema,如下图:
上传saiku.xml,内容如下:
<Schema name="test_schema">
<cube name="test_cube">
<Table name="t_data"/>
<Dimension name="user" foreignKey="user_id">
<Hierarchy hasAll="true" allMemberName="user_id" primaryKey="user_id">
<Table name="t_user"/>
<Level name="user_id" column="user_id" uniqueMembers="true" type="Integer"/>
</Hierarchy>
</Dimension>
<Measure column="count" aggregator="sum" datatype="Numeric" name="all_count" caption="all_count"/>
</cube>
</Schema>
2、添加数据源,我使用的是postgresql
首先添加数据表:
CREATE TABLE t_data
(
user_id integer,
count numeric(4,2)
);
CREATE TABLE t_user
(
user_id serial NOT NULL,
user_name character varying(50),
pwd character varying(50)
);
--t_data的数据
1;33.00
2;32.00
3;34.00
4;38.00
2;23.00
2;3.00
--t_user的数据
1;"user1";"1"
2;"user2";"2"
3;"user3";"3"
4;"user4";"4"
3、添加数据源
其中url的格式是:jdbc:postgresql://l-***.tkt.cn6.***.com:5432/saiku
查看数据
拖动字段到如下位置即可:
四、参考:
saiku开源的github地址:https://github.com/OSBI/saiku
saiku安装过程:http://blog.csdn.net/gsying1474/article/details/45918275
五、后记
我会持续跟进saiku的使用,在以后的博文中会介绍schema的编写规范,英文文档链接如下:http://mondrian.pentaho.com/documentation/schema.php