2013年5月20日 星期一

BI Pentaho 介紹


Pentaho介紹

Pentaho是世界上領先的開放原始碼商業智慧套件Pentaho BI提供了全面的報表、 OLAP分析、儀表板、資料整合、資料探勘和商業智慧平台等相關套件, 在開放原始碼的商業智慧領域中居於領先。 Pentaho的商用開放原始碼的商業模式免去了軟體授權的費用,透過年度訂閱方式提供支援、服務與產品更新等服務。 近幾年Pentaho已成為商用開放原始碼BI的先驅, 產品模組已經被下載超過300萬次,客戶涵蓋小型企業到全球2000大。



榮譽與獎項
Pentaho近年來表現突出,屢受獎項肯定:
  • Red Herring 100 Award
  • InfoWorld Bossie Award 2010
  • Ventana Research Leadership Award 2010 for StoneGate Senior Care
  • CRN Emerging Technology Vendor 2010
  • Five Stars in CRN's 2011 Partner Programs Guide
  • JBoss Innovation Award 2008
  • 更多獎項請參考



主要特色
  • 以Java為基礎,是目前開放程式碼中最完整的商業智慧分析平台。
  • Pentaho所有的組件,是圍繞著業務流程來運作,可配合客戶關係管理(CRM)系統使用, 匯入從SugarCRM生成的OLAP分析和報表作進一步處理。
  • Pentaho Server可運行於主流的J2EE支援的Web Server (如Apache Tomcat、JBOSS AS、WebSphere、WebLogic與Oracle AS)
  • Pentaho支援跨平台,Linux、Windows等作業系統。




產品模組

Pentaho BI套件除具有完整的商業智慧功能外,更提供企業資料數據服務,支援以Apache Hadoop來處理巨量資料 Big Data的分析。Pentaho BI套件包含:
  • Pentaho BI 平台與伺服器
  • Pentaho 資料整合
  • Pentaho 分析服務
  • Pentaho 報表模組
  • Pentaho 資料探勘
  • Pentaho 儀表板
  • Apache Hadoop模組


*

Pentaho BI 平台與伺服器


Pentaho BI平台提供架構與基礎設備用以建置對BI問題的解決方案。 架構提供的核心服務包含認證、記錄、稽核、網路服務與規則引擎。 平台也包含一個解決方案引擎整合報表、分析、儀表板與資料探勘模組。 模組性的設計與插件的架構讓所有或部分的平台被使用以整合至第三方應用程式,如同OEM。
最為知名的BI平台實作是Pentaho BI 伺服器, 功能包含一個網頁報表管理系統、應用程式整合伺服器與輕量級工作流程引擎以便與任何企業流程整合。


Pentaho 資料整合


Pentaho資料整合,專案又稱為Kettle,包含一個資料整合(ETL)引擎,和GUI應用程式允許使用者定義資料整合工作與移轉。 Pentaho資料整合支援部署在一個雲或是叢集架構的單一電腦上。
Pentaho資料整合包含了幾個工具以處理移轉與工作,工作通常被排程以批次模式去自動執行在正常時間區間。
  • Spoon是一個圖形化使用者介面讓您能設計轉移與工作,再執行於Pan與Kitchen。
  • Pan是一個資料轉移引擎能執行多維函式,如讀取、處理與寫資料於不同資料來源。
  • Kitchen是一個程式執行能被Spoon設計的工作,可存於XML或資料庫。
  • Carte是一個簡單Web Server讓您遠端執行轉移與工作。 Carte藉著接受XML包含轉移以執行與執行設定。 Carte也讓您遠端監控監視器、啟動、停止執行於Carte伺服器的轉移與工作。 在Pentaho資料整合術語中,一個伺服器執行於Carte稱為Slave伺服器。
  • 還有一個工具Encr可以讓您產生混淆的密碼。


Pentaho 分析服務


Pentaho分析服務,專案又稱為Mondrian OLAP server,一個以Java開發的開放原始碼OLAP(Online Analytical Processing, 線上分析處理)引擎。 Pentaho分析服務支援 MDX(multidimensional expressions)查詢語言與XML以應用於分析與olap4j介面規格。 Pentaho分析服務讀取SQL與其他資料來源並在一個記憶快取中加速。
線上分析處理 OLAP 意指即時性分析大量資料。 不像線上交易處理(Online Transaction Processing, OLTP),進行典型操作如讀取與修改個別和小型記錄, OLAP一次處理大量資料,與一般的唯讀操作。 線上指雖然牽涉大量資料 - 典型百萬數量以上的記錄, 佔上好幾個Gigabytes - 系統必須負責查詢足夠快到讓資料的互動探索。 以我們所看到,代表可考量的科技挑戰。 OLAP運用的技術稱為樞紐分析。


Pentaho 報表模組


Pentaho報表模組包含一個報表引擎,能夠基於XML定義檔案以程式產生報表。 伴隨報表引擎許多工具被開發以供使用,包含GUI設計工具與報表精靈方便使用者快速產生報表,在不需要寫任何程式下使用圖形工具設計報表。
使用Pentaho Report Designer,您能在圖形下環境開發報表定義。 報表能出版至Pentaho平台,讓您能管理、執行與定期執行報表。


Pentaho 資料探勘


Pentaho資料探勘架構於Weka開放原始碼機器學習軟體套件之上。Pentaho資料探勘是一組複雜的工具可進行機器學習與資料探勘。 大量的在分類、回歸、關聯規則與叢集演算法能被使用以幫助更好地分析理解企業,並進一步經由預測分析改善效能。


Pentaho 儀表板


Pentaho儀表板是一個整合平台對資料提供視覺顯示,能在上面檢視由Pentaho報表設計器所開發的各種互動報表與樞紐分析。 將您的企業資料動態以集中式的儀表板樣式呈現,讓您在監視追蹤時並能產生決策。


Pentaho Apache Hadoop 模組


*Pentaho支援Apache Hadoop提供簡單使用、可用的ETL與分析功能以降低導入巨量資料Big Data的風險。 Pentaho支援Apache Hadoop資料整合與Pentaho套件著重於Hadoop使用者最大的挑戰,即艱鉅的技術學習曲線,缺乏夠優秀的工具、缺乏在Hadoop上開發與部署應用程式等相關BI的可用性。


Bi server 3.10.0-stable
Bi server 4.5.0-stable




安裝
安裝 jdk1.6 or jdk1.7
些改環境變數Java_home and Path
Add the line: export JAVA_HOME=”/usr/lib/jvm/java-6-openjdk”
修改start-pentaho
set JRE_HOME=C:\Program Files\Java\jre6

調整JVM參數 C:\biserver-ce-3.10.0-stable\biserver-ce\
set CATALINA_OPTS=-Xms512m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

根據 1/2 原則,我們通常要保證-Xmx 參數取值不要超過實體記憶體的1/2。比如,物理機
器記憶體為2G,則-Xmx 取值最好不要超過1G2G*1/2),而-Xms 取值最好不要低於-Xmx
1/2,即512m 左右。不過,不同生產環境的差異性太大,建議用戶能夠在生產前進行嚴
格的壓力及調優測試,並靈活調整JVM 參數。

調整Apache Tomcat 參數C:\biserver-ce-3.10.0-stable\biserver-ce\tomcat\conf\server.zml
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
通常,我們需要調整maxThreadsminSpareThreadsmaxSpareThreadsacceptCount
參數取值。大部分情況下,可以考慮將它們的取值設置成默認的2 倍左右,即maxThreads
設置成300minSpareThreads 設置成50maxSpareThreads 設置成150acceptCount 設置成
200
注意,不同生產環境的差異性較大,建議用戶能夠在上線前進行嚴格的壓力及調優測試,
並靈活調整Apache Tomcat 參數,畢竟參數不是越大越好,因為這些參數取值要同硬體能力
相匹配,否則得不償失。

將Pentaho BI 服務器的資料遷移到PostgreSQL 數據庫
1.將驅動(postgresql-9.1-901.jdbc4.jar)複製到C:\biserver-ce-3.10.0-stable\administration-console\lib、C:\biserver-ce-3.10.0-stable\administration-console\jdbc、C:\biserver-ce-3.10.0-stable\biserver-ce\tomcat\lib、C:\biserver-ce-3.10.0-stable\biserver-ce\tomcat\webapps\pentaho\WEB-INF\lib

2.創建hibernate and quartz 資料庫,
hibernate 執行C:\biserver-ce-3.10.0-stable\biserver-ce\data\postgresql\create_repository_postgresql.sql
drop database if exists hibernate;
drop user if exists hibuser;

CREATE USER hibuser PASSWORD 'password';

CREATE DATABASE hibernate WITH OWNER = hibuser ENCODING = 'UTF8' TABLESPACE = pg_default;

GRANT ALL PRIVILEGES ON DATABASE hibernate to hibuser;

\connect hibernate hibuser
C:\biserver-ce-3.10.0-stable\biserver-ce\data\postgresql\ create_sample_datasource_postgresql.sql
\connect hibernate hibuser  ---刪除

quartz 執行
C:\biserver-ce-3.10.0-stable\biserver-ce\data\postgresql\ create_quartz_postgresql.sql
---以下刪除
drop database if exists quartz;
drop user if exists pentaho_user;

CREATE USER pentaho_user PASSWORD 'password';

CREATE DATABASE quartz  WITH OWNER = pentaho_user  ENCODING = 'UTF8' TABLESPACE = pg_default;

GRANT ALL ON DATABASE quartz to pentaho_user;

\connect quartz pentaho_user

3.修改 context.xml 把以前的mark<!--  -->掉
C:\biserver-ce-3.10.0-stable\biserver-ce\tomcat\webapps\pentaho\META-INF\
<?xml version="1.0" encoding="UTF-8"?>
<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="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:hsql://localhost/hibernate"
validationQuery="select count(*) from INFORMATION_SCHEMA.SYSTEM_SEQUENCES" />
<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="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:hsql://localhost/quartz"
validationQuery="select count(*) from INFORMATION_SCHEMA.SYSTEM_SEQUENCES"/>
-->
<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="org.postgresql.Driver" url="jdbc:postgresql://192.168.2.149:5432/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="org.postgresql.Driver" url="jdbc:postgresql://192.168.2.149:5432/quartz"
validationQuery="select 1"/>

</Context>

4.修改 hibernate-settings.xml
C:\biserver-ce-3.10.0-stable\biserver-ce\pentaho-solutions\system\hibernate
   <config-file>system/hibernate/postgresql.hibernate.cfg.xml</config-file>

5.修改 postgresql.hibernate.cfg.xml
C:\biserver-ce-3.10.0-stable\biserver-ce\pentaho-solutions\system\hibernate
   <property name="connection.username">postgres</property>
   <property name="connection.password">!QAZ2wsx</property>

6.修改 applicationContext-spring-security-hibernate.properties
C:\biserver-ce-3.10.0-stable\biserver-ce\pentaho-solutions\system
#jdbc.driver=org.hsqldb.jdbcDriver
#jdbc.url=jdbc:hsqldb:hsql://localhost:9001/hibernate
#jdbc.username=hibuser
#jdbc.password=password
#hibernate.dialect=org.hibernate.dialect.HSQLDialect

jdbc.driver=org.postgresql.Driver
jdbc.url=jdbc:postgresql://192.168.2.149:5432/hibernate
jdbc.username=postgres
jdbc.password=!QAZ2wsx
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

7.修改 quartz.properties
C:\biserver-ce-3.10.0-stable\biserver-ce\pentaho-solutions\system\quartz
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate


一、修改Pentaho 資料庫鏈結
3. Set the spring-security to the MySQL database
Navigate up one folder level, and edit the file:
路徑:/Pentaho/biserver-ce/Pentaho-solutions/system/
(1)applicationContext-spring-security-jdbc.xml
4. Modify the file that list the jndi (datasources) connections Edit:
(1)Pentaho/biserver-ce/pentaho-solutions/system/simple-jndi/jdbc.properties
5.jdbc.properties
(1)/Pentaho/biserver-ce/tomcat/conf/Catalina/localhost/pentaho.xml

二、Linux 需要修改讓執行檔可執行
Sudo chmod +x *.sh Pentaho/

三、修改Java 環境
(1)biserver-ce/start-pentaho.bat or start-pentaho.sh
default:set CATALINA_OPTS=-Xms256m -Xmx768m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
After:set CATALINA_OPTS=-Xms2048m -Xmx2048m -XX:MaxPermSize=512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
修改記憶體
(2)biserver-ce\pentaho-solutions\system\mondrian\mondrian.properties
Default:
mondrian.result.limit=5000000
mondrian.rolap.queryTimeout=300
After:
mondrian.result.limit=20000000
mondrian.rolap.queryTimeout=0

四、加入.jar
Tomcat/lib 加入postgres1-9.1-901.jdbc4.jar、jtds-1.2.5.jar、mysql.jar
Administrator/jdbc/ 加入postgres1-9.1-901.jdbc4.jar、jtds-1.2.5.jar

五、還原quartz
Biserver-ce/data/postgresql/create_quartz_postgresql.sql 以下內容刪掉
--
-- note: this script assumes pg_hba.conf is configured correctly
--

-- \connect postgres postgres

drop database if exists quartz;
drop user if exists pentaho_user;

CREATE USER pentaho_user PASSWORD 'password';

CREATE DATABASE quartz  WITH OWNER = pentaho_user  ENCODING = 'UTF8' TABLESPACE = pg_default;

GRANT ALL ON DATABASE quartz to pentaho_user;

\connect quartz pentaho_user

begin;

drop table if exists qrtz_job_listeners;
drop table if exists qrtz_trigger_listeners;
drop table if exists qrtz_fired_triggers;
drop table if exists qrtz_paused_trigger_grps;
drop table if exists qrtz_scheduler_state;
drop table if exists qrtz_locks;
drop table if exists qrtz_simple_triggers;
drop table if exists qrtz_cron_triggers;
drop table if exists qrtz_blob_triggers;
drop table if exists qrtz_triggers;
drop table if exists qrtz_job_details;
drop table if exists qrtz_calendars;

六、Publish
修改/pentaho-solutions/system/publisher_config.xml
<publisher-config>
       <publisher-password>123456</publisher-password>
</publisher-config>

七、修改quartz.properties
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate

八、jpivor.jar
上傳jpivor.jar to tomcat/webapps/pentaho/WEB-INF/lib

九、上傳datasource.xml
修改加入pentaho-solutions/system/olap/datasources.xml
<Catalog name="AnalysisCube">            <DataSourceInfo>Provider=mondrian;DataSource=bi_postgres;EnableXmla=False</DataSourceInfo>
<Definition>solution:/voir/analysis/AnalysisCube-Schema.xml</Definition>
</Catalog>

十、create/voir/analysis
創資料夾 pentaho-solutions/voir/analysis
上傳AnalysisCub-Schema.xml 到創立資料夾/voir/analysis
七、修改
上傳 tomcat/webapps/pentaho and tomcat/webapps/pentaho and /pentaho-solutions/saiku
取代原本,
並且刪除
Tomcat/conf/Catalina 資料夾
修改
\biserver-ce-3.10.0-stable\biserver-ce\pentaho-solutions\system\olap\datasources.xml
<?xml version="1.0" encoding="UTF-8"?>

<DataSources>
 <DataSource>
   <DataSourceName>Provider=Mondrian;DataSource=Pentaho</DataSourceName>  
   <DataSourceDescription>Pentaho BI Platform Datasources</DataSourceDescription>  
   <URL>http://localhost:8080/pentaho/Xmla?userid=joe&amp;password=password</URL>  
   <DataSourceInfo>Provider=mondrian</DataSourceInfo>  
   <ProviderName>PentahoXMLA</ProviderName>  
   <ProviderType>MDP</ProviderType>  
   <AuthenticationMode>Unauthenticated</AuthenticationMode>  
   <Catalogs>
     <Catalog name="SteelWheels">
       <DataSourceInfo>Provider=mondrian;DataSource=SampleData</DataSourceInfo>  
       <Definition>solution:steel-wheels/analysis/steelwheels.mondrian.xml</Definition>
     </Catalog>  
     <Catalog name="SampleData">
       <DataSourceInfo>Provider=mondrian;DataSource=SampleData</DataSourceInfo>  
       <Definition>solution:steel-wheels/analysis/SampleData.mondrian.xml</Definition>
     </Catalog>  
     <Catalog name="AnalysisCube">
       <DataSourceInfo>Provider=mondrian;DataSource=bi_postgres;EnableXmla=False</DataSourceInfo>  
       <Definition>solution:/voir/analysis/AnalysisCube-Schema.xml</Definition>
     </Catalog>  
   </Catalogs>
 </DataSource>
</DataSources>



設定
自動執行(Edit analysis to disable and enable auto run query) Settings.js
C:\soft\biserver-ce-3.10.0-stable\biserver-ce\pentaho-solutions\system\saiku\ui\js\saiku
關閉
'saiku.olap.query.automatic_execution': 'false',
開啟
'saiku.olap.query.automatic_execution': 'true',





問題:SQLException: invalid schema name: public in statement [select "bi_closing_openinig"."f_brncde" as "c0" from "public"."bi_closing_openinig

A:檢查biserver-ce-3.10.0-stable-local\biserver-ce\pentaho-solutions\system\olap\datasources.xml

<Catalog name="AnalysisCube">
       <DataSourceInfo>Provider=mondrian;DataSource=bi_postgres;EnableXmla=False</DataSourceInfo>  
       <Definition>solution:/voir/analysis/AnalysisCube-Schema.xml</Definition>
     </Catalog>



修改Pentaho 資料庫鏈結
3. Modify system connections to MySql: hibernate and quartz
Use the file file navigator ‘nautilus’ (on the desktop menu: Places->Personal folder) to the following folder:
/Pentaho/bi-server/tomcat/webapps/pentaho/META-INF/
Note that this are the tomcat (web server) files. Edit (right click->open with->gedit):
*context.xml
4. Redirect Hibernate to MySql
Navigate to:
/Pentaho/bi-server/pentaho-solutions/system/hibernate/
This are the Pentaho config files. Open with gedit:
*hibernate-settings.xml
Save the file. In gedit open in the same folder:
*mysql5.hibernate.cfg.xml

5. Set the spring-security to the MySQL database
We’ll change the spring security files (until 3.5 the technology was ‘acegi’, but on 3.6 they rename it).  Navigate up one folder level, and edit the file:
/Pentaho/biserver-ce/Pentaho-solutions/system/
*applicationContext-spring-security-hibernate.properties

*applicationContext-spring-security-jdbc.xml

6. Modify the file that list the jndi (datasources) connections
Edit:
*Pentaho/biserver-ce/pentaho-solutions/system/simple-jndi/jdbc.properties

/Pentaho/biserver-ce/tomcat/conf/Catalina/localhost/pentaho.xml
*Lim HongShin: jdbc.properties


Perforenece Tuning
Set Tomcat
a.vi Tomcat/bin/catalina.sh
JAVA_OPTS="-Xms2304m -Xmx2304m -XX:MaxPermSize=512m -Djava.rmi.server.hostname=192.168.0.101"
Set tomcat memory
Min & max
-Xms = min
-Xmx = max
MaxPermSize is Java Setting
All together is 2304+542 MB memory allocated for this tomcat

b.vi Tomcat/conf/server.xml
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="3000" minSpareThreads="4"/>
Set maxThreads =3000
第59行 設定Tomcat最大連接數3000

Set System
  1. ipcs –l
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536
b.vi /etc/sysctl.conf
kernel.sem=1250 2560000 100 1024
第31行加入上面
c./sbin/sysctl –p
d.ipcs –l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 1024
max semaphores per array = 1250
max semaphores system wide = 2560000
max ops per semop call = 100
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536
Set Postgresql
a.vi data/postgresql.conf
shared_buffers = 1024MB
Default is 32MB setting total RAM 1/4 memory


沒有留言:

張貼留言