標籤:
最近研究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-ce\pentaho-solutions\system\下。
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-workbench\plugins下的pull-parser.jar
6. 如使用schema-workbench提交時,提交密碼在\server\biserver-ce\pentaho-solutions\system目錄下的publisher_config.xml檔案中設定
pentaho資料庫HSQLDB遷移至mysql步驟:
1. 由於pentaho內建了mysql資料庫的初始化指令碼在目錄 D:\biserver-ce\data\mysql5下面。我們通過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:\biserver-ce\pentaho-solutions\syste 目 錄 下 的 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:\biserver-ce\pentaho-solutions\system\hibernate下的 hibernate-settings.xml檔案。 它的作用:基本的hibernate設定,例如hibernate的資料庫後台。修改成如下所示:
<config-file>system/hibernate/mysql5.hibernate.cfg.xml</config-file>
5. 確認檔案目錄D:\biserver-ce\pentaho-solutions\system\hibernate下的檔案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:\biserver-ce\tomcat\webapps\pentaho\WEB-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:\biserver-ce\tomcat\webapps\pentaho\META-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>
saiku安裝方法總結