saiku安装方法总结

最近研究pentaho和saiku,在网上搜集了一些安装和配置的方法,亲测有效,在这分享总结一下方便日后使用。

Saiku主要提供两种安装方式,独立运行和集成在Pentaho BI平台上,本文会简单介绍这两种安装方式。

一、集成在Pentaho BI平台上
pentaho环境安装saiku插件步骤:
1. 所需文件:
biserver-ce-4.8.0-stable
(下载地址 http://nchc.dl.sourceforge.net/project/pentaho/Business%20Intelligence%20Server/4.8.0-stable/biserver-ce-4.8.0-stable.zip)
psw-ce-3.6.1
(下载地址 http://www.mirrorservice.org/sites/dl.sourceforge.net/pub/sourceforge/m/mo/mondrian/schema%20workbench/3.6.1-stable/psw-ce-3.6.1.zip)
saiku-plugin-2.6
(下载地址 http://www.meteorite.bi/downloads/saiku-plugin-2.6)
pull-parser-2.1.10.jar
(下载地址 http://mirrors.ibiblio.org/pub/mirrors/maven2/pull-parser/pull-parser/2.1.10/pull-parser-2.1.10.jar)

2. 解压biserver-ce-4.8.0-stable,得到biserver-ce和administration-console文件夹。

3. 将saiku-plugin-2.6解压到biserver-cepentaho-solutionssystem下。

4. 解压psw-ce-3.6.1,得到schema-workbench文件夹,修改workbench.bat文件。
找到“rem you should also put mondrian.properties on the calsspath for it to be picked up” 这一行并在下方添加 set CP=%CP%;./mondrian.properties;
找到“rem add all needed JDBC drivers to the classpath” 这一行并在下方添加 set CP=%CP%;lib/驱动jar包(如果有多个驱动JAR文件,就添加多行)

5. 如使用schema-workbench提交时报错:
Nested exception: org.gjt.xpp.impl.tokenizer.TokenizerException: white space expected before attribute name and not 't' at line 1 and column 134 seen ...
解决方案:
下载http://mirrors.ibiblio.org/pub/mirrors/maven2/pull-parser/pull-parser/2.1.10/pull-parser-2.1.10.jar替换schema-workbenchplugins下的pull-parser.jar

6. 如使用schema-workbench提交时,提交密码在serveriserver-cepentaho-solutionssystem目录下的publisher_config.xml文件中设置


pentaho数据库HSQLDB迁移至mysql步骤:
1. 由于pentaho自带了mysql数据库的初始化脚本在目录 D:iserver-cedatamysql5下面。我们通过navicat for mysql 可视化图形工具来按如下顺序依次导入mysql脚本:create_repository_mysql ,再create_quartz_mysql,最后再create_sample_datasource_mysql
简单介绍一下各脚本文件的对应的功能: create_repository_mysql.sql 创建hibernate数据库,建用户hibuser,密码为password,对库有完全权限,建DATASOURCE表。 create_quartz_mysql.sql 创建quartz数据库,建用户pentaho_user,密码为password,对库有完全权限,建了很多QRTZ_开头的表 create_sample_datasource_mysql.sql 向hibernate库的DATASOURCE表里面插入一个记录,数据源即是在这里定义,显示在管理控制台里面的Data Sources栏目里面

2. 修 改 D:iserver-cepentaho-solutionssyste 目 录 下 的 applicationContext-spring-security-jdbc.xml文件, 此文件作用:给BI server所用的Spring Security system建立JDBC认证。 对应值修改后应为:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/hibernate" />
<property name="username" value="hibuser" />
<property name="password" value="password" />
</bean>

3. 修改同一目录下的applicationContext-spring-security-hibernate.properties文件, 此文件作用:设置属性参数用于Spring Security来建立数据库与hibernate的连接。 将文件中设置修改为如下:
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/hibernate
jdbc.username=hibuser
jdbc.password=password
hibernate.dialect=org.hibernate.dialect.MySQLDialect

4. 修改目录D:iserver-cepentaho-solutionssystemhibernate下的 hibernate-settings.xml文件。 它的作用:基本的hibernate设置,例如hibernate的数据库后台。修改成如下所示:
<config-file>system/hibernate/mysql5.hibernate.cfg.xml</config-file>

5. 确认文件目录D:iserver-cepentaho-solutionssystemhibernate下的文件mysql5.hibernate.cfg.xml 其作用:配置hibernate数据库的mysql连接,这样就允许BI server内部的管理连接。 应该的配置是:
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property>
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="connection.username">hibuser</property>
<property name="connection.password">password</property>

6. 配置D:iserver-ce omcatwebappspentahoWEB-INF目录下的web.xml文件 设置为:
<context-param>
<param-name>base-url</param-name>
<param-value>http://192.168.0.60:8080/pentaho/</param-value>
</context-param>
说明:如果是localhost,那么仅能从本机登录才能打开sampledata报表,如果是实际ip。那样就能从别的机器登录了。

7. 修改D:iserver-ce omcatwebappspentahoMETA-INF目录下的context.xml文件。 其作用:建立hibernate和quartz两者的配置文件。
<Context path="/pentaho" docbase="webapps/pentaho/">
<Resource name="jdbc/Hibernate" auth="Container" type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20" maxIdle="5"
maxWait="10000" username="hibuser" password="password"
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hibernate"
validationQuery="select 1"/>
<Resource name="jdbc/Quartz" auth="Container" type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20" maxIdle="5"
maxWait="10000" username="pentaho_user" password="password"
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/quartz"
validationQuery="select 1"/>
</Context>


二、独立安装saiku(tomcat上部署)
1.所需文件:
saiku-ui-2.6.war(下载地址 http://www.meteorite.bi/downloads/saiku-ui-2.6.war)
saiku-webapp-2.6.war(下载地址 http://www.meteorite.bi/downloads/saiku-webapp-2.5.war)
mysql-connector-java-5.1.35(数据库对应版本)

2.Saiku webapps 部署:
saiku-ui-2.6.war修改成ROOT.war; saiku-webapp-2.6.war修改成saiku.war;拷贝两个war文件到tomcat/webapp目录下,现在可以启动tomcat;然后再浏览器中输入:http://localhost:8080,以看到Saiku的登录页面,输入admin和admin作为密码登录Saiku。

3.配置Saiku使用cubeSchema 和数据库:
停止tomcat,然后拷贝数据库对应的jdbc jar(此处为mysql-connector-java-5.1.35)到tomcat/lib文件夹中。
拷贝schema(xml格式)文件到tomcat/webapps/saiku/WEB-INF/classes/saiku-datasources/
在tomcat/webapps/saiku/WEB-INF/classes/saiku-datasources/目录下创建一个配置文件sales.txt并写入以下内容(每个cube对应一个配置文件,名字不限,但只能配置一个,不能共享。(在一个文件中,配置两个,后面的会覆盖前面的。新建一个cube,新建一个datasources配置说明。只有配置了说明文件,才能在saiku里显示。):

#declaration of Sauce Dallas sales cube for Sakiu
#———————————————
type=OLAP
name=SauceDallas
driver=mondrian.olap4j.MondrianOlap4jDriver
location=jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/dbtest1;Catalog=res:saiku-datasources/Schema1.xml;JdbcDrivers=com.mysql.jdbc.Driver;
username=root
password=root

配置说明:
type=OLAP指定一个 OLAP 引擎.没有见过非OLAP的属性值。
name : 给你的数据源命名。
driver: 指定 Mondrian driver(将二维关系表转化为多维度表的驱动).没有见过其他的属性值。
location :这个属性有几个部分组成,使用分号分隔。

jdbc:mondrian:Jdbc=jdbc:mysql://localhost/1_tutorialSaiku :
指定数据库对应jdbc url,前面部分不需要改动,仅仅需要修改主机和对应的数据库名称。这里的主机是localhost,对应数据库是1_tutorialSaiku

Catalog=res:saiku-datasources/sales_mondrian_schema.xml
指定mondrian schema文件。res表明是文件的路径,这里是从saiku webapp目录开始;

JdbcDrivers=com.mysql.jdbc.Driver
指明java 类文件作为数据库连接驱动。

4.重启tomcat后报错java.io.NotSerializableException解决方法:
原因是:tomcat停止时,保存session资源,然后在重启服务后,会尝试恢复session。
打开tomcat下/conf/context.xml文件,添加如下内容:
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>

原文地址:https://www.cnblogs.com/Jason-Xiang/p/4720053.html