1. 程式人生 > 實用技巧 >開源商務智慧軟體Pentaho

開源商務智慧軟體Pentaho

1 簡介

Pentaho是世界上最流行的開源商務智慧軟體,以工作流為核心的,強調面向解決方案而非工具元件的,基於java平臺的商業智慧(Business Intelligence,BI)套件BI,之所以說是套件是因為它包括一個web server平臺和幾個工具軟體:報表,分析,圖表,資料整合,資料探勘等,可以說包括了商務智慧的方方面面。它整合了多個開源專案,目標是和商業BI相抗衡。它偏向於與業務流程相結合的BI解決方案,側重於大 中型企業應用。它允許商業分析人員或開發人員建立報表,儀表盤,分析模型,商業規則和 BI 流程。

注:以上感覺高大上,但筆者比較鄙視Pentaho這個專案,從佈署的角度看,完全沒有支撐該專案的標準文件,只有零星的資料,要部署好只能靠反覆測試和摸索。

2 實踐部分

2.1 環境部分

2.1.1 執行環境

IP Address = 10.168.0.76

HostName = pentaho.cmdschool.org

OS = CentOS 7.3

2.1.2 安裝輔助工具

yuminstall-yunzip

2.1.3 配置防火牆

firewall-cmd--permanent--add-port8080/tcp
firewall-cmd--reload
firewall-cmd--list-all

2.2 MySQL配置

2.2.1 配置MySQL的源

vim/etc/yum.repos.d/mysql56-community.repo

輸入如下內容:

#EnabletouseMySQL5.6
[mysql56-community]
name=MySQL5.6CommunityServer
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.mysql.com/RPM-GPG-KEY-mysql

2.2.2 安裝相關包

yuminstall-ymysql-community-servermysql-community-develmysql-community-client

2.2.3 啟動並配置預設開機啟動

systemctlstartmysqld
systemctlenablemysqld

2.2.4 初始化資料庫

mysql_secure_installation

嚮導如下:

[...]
Setrootpassword?[Y/n]y
Newpassword:
Re-enternewpassword:
[...]
Removeanonymoususers?[Y/n]y
[...]
Disallowrootloginremotely?[Y/n]n
[...]
Removetestdatabaseandaccesstoit?[Y/n]y
[...]
Reloadprivilegetablesnow?[Y/n]y
[...]

2.3 Java配置

2.3.1 建立java目錄

mkdir/usr/java

2.3.2 下載JDK

cd/usr/java
wgethttp://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz?AuthParam=1495873209_eea482e2b59774918c970cf5dc383fdb

2.3.3 解壓安裝包

tar-xfjdk-8u121-linux-x64.tar.gz

2.3.4 配置環境變數

vim/etc/profile

末尾加入如下內容:

exportJAVA_HOME=/usr/java/jdk1.8.0_121
exportJRE_HOME=${JAVA_HOME}/jre
exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
exportPATH=${JAVA_HOME}/bin:$PATH

2.3.5 使環境變數生效

source/etc/profile

2.3.6 測試環境變數

java-version

2.4 Pentaho安裝包配置

2.4.1 下載程式包

mkdir/usr/pentaho
cd/usr/pentaho
wgethttps://nchc.dl.sourceforge.net/project/pentaho/Business%20Intelligence%20Server/7.0/pentaho-server-ce-7.0.0.0-25.zip
wgethttps://nchc.dl.sourceforge.net/project/pentaho/Data%20Integration/7.0/pdi-ce-7.0.0.0-25.zip
wgethttps://nchc.dl.sourceforge.net/project/pentaho/Report%20Designer/7.0/prd-ce-7.0.0.0-25.zip

注:下載連結,https://sourceforge.net/projects/pentaho/files/

2.4.2 解壓程式包

unzippentaho-server-ce-7.0.0.0-25.zip
unzippdi-ce-7.0.0.0-25.zip
unzipprd-ce-7.0.0.0-25.zip

2.4.3 更換mysql連線驅動

cd~
wgethttps://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.41.tar.gz
tar-xfmysql-connector-java-5.1.41.tar.gz
cpmysql-connector-java-5.1.41/mysql-connector-java-5.1.41-bin.jar/usr/pentaho/pentaho-server/tomcat/lib/
mv/usr/pentaho/pentaho-server/tomcat/lib/mysql-connector-java-5.1.17.jar~/

注:下載連結,https://dev.mysql.com/downloads/connector/j/

2.4.4 修改Tomcat執行環境變數

vim/usr/pentaho/pentaho-server/tomcat/bin/setenv.sh

修改內容如下:

exportJAVA_HOME=/usr/java/jdk1.8.0_121
exportJRE_HOME=${JAVA_HOME}/jre
exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
exportPATH=${JAVA_HOME}/bin:$PATH
exportPENTAHO_JAVA_HOME=${JAVA_HOME}
exportINSTALL_HOME=/usr/pentaho/pentaho-server
exportDI_HOME=${INSTALL_HOME}/pentaho-solutions/system/kettle
exportCATALINA_OPTS="-Xms4096m-Xmx6144m-XX:MaxPermSize=256m-Dsun.rmi.dgc.client.gcInterval=3600000-Dsun.rmi.dgc.server.gcInterval=3600000-DDI_HOME=$DI_HOME"

2.4.5 建立程式執行使用者

useradd-s/sbin/nologin-b/usr/pentaho

確認使用者家目錄

ls-ld/usr/pentaho

2.4.6 預配置esapi目錄

mkdir/usr/pentaho/esapi

2.4.7 配置目錄許可權

chown-Rpentaho:pentaho/usr/pentaho/
chmod-R770/usr/pentaho

2.5 資料庫服務配置

2.5.1 修改quartz庫的授權

vim/usr/pentaho/pentaho-server/data/mysql5/create_quartz_mysql.sql

註釋掉如下行:

#grantallonquartz.*to'pentaho_user'@'localhost'identifiedby'password';

2.5.2 修改hibernate庫的授權

vim/usr/pentaho/pentaho-server/data/mysql5/create_repository_mysql.sql

註釋掉如下行:

#GRANTALLONhibernate.*TO'hibuser'@'localhost'identifiedby'password';

2.5.3 修改jackrabbit庫的授權

vim/usr/pentaho/pentaho-server/data/mysql5/create_jcr_mysql.sql

註釋掉如下行:

#grantallonjackrabbit.*to'jcr_user'@'localhost'identifiedby'password';

2.5.4 匯入資料庫

mysql-uroot-p</usr/pentaho/pentaho-server/data/mysql5/create_quartz_mysql.sql
mysql-uroot-p</usr/pentaho/pentaho-server/data/mysql5/create_repository_mysql.sql
mysql-uroot-p</usr/pentaho/pentaho-server/data/mysql5/create_jcr_mysql.sql

2.5.5 配置資料庫許可權

mysql-uroot-p
grantallonquartz.*to'pentaho'@'localhost'identifiedby'passwd';
grantallonhibernate.*to'pentaho'@'localhost'identifiedby'passwd';
grantallonjackrabbit.*to'pentaho'@'localhost'identifiedby'passwd';
flushprivileges;

2.5.6 測試資料庫

mysql-upentaho-ppasswd

2.6 遷移資料庫等配置

2.6.1 配置Quartz

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/quartz/quartz.propertiespentaho-solutions/system/quartz/quartz.properties.default
vimpentaho-solutions/system/quartz/quartz.properties

修改並啟用如下引數:

org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.dataSource.myDS.jndiURL=Quartz

2.6.2 配置hibernate資料來源

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/hibernate/mysql5.hibernate.cfg.xmlpentaho-solutions/system/hibernate/mysql5.hibernate.cfg.xml.default
vimpentaho-solutions/system/hibernate/mysql5.hibernate.cfg.xml

修改如下標籤引數:

<propertyname="connection.username">pentaho</property>
<propertyname="connection.password">passwd</property>

2.6.3 配置Hibernate

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/hibernate/hibernate-settings.xmlpentaho-solutions/system/hibernate/hibernate-settings.xml.default
vimpentaho-solutions/system/hibernate/hibernate-settings.xml

修改如下標籤引數:

<config-file>system/hibernate/mysql5.hibernate.cfg.xml</config-file>

2.6.4 配置審計日誌

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/audit_sql.xmlpentaho-solutions/system/audit_sql.xml.default
cppentaho-solutions/system/dialects/mysql5/audit_sql.xmlpentaho-solutions/system/

2.6.5 配置repository.xml

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/jackrabbit/repository.xmlpentaho-solutions/system/jackrabbit/repository.xml.default
vimpentaho-solutions/system/jackrabbit/repository.xml

註解以下標籤和內容:

<FileSystemclass="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<paramname="path"value="${rep.home}/repository"/>
</FileSystem>

去掉以下標籤和內容註解並修改賬號密碼:

<FileSystemclass="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<paramname="driver"value="com.mysql.jdbc.Driver"/>
<paramname="url"value="jdbc:mysql://localhost:3306/jackrabbit"/>
<paramname="user"value="pentaho"/>
<paramname="password"value="passwd"/>
<paramname="schema"value="mysql"/>
<paramname="schemaObjectPrefix"value="fs_repos_"/>
</FileSystem>

註解以下標籤和內容:

<DataStoreclass="org.apache.jackrabbit.core.data.FileDataStore"/>

去掉以下標籤和內容註解並修改賬號密碼:

<DataStoreclass="org.apache.jackrabbit.core.data.db.DbDataStore">
<paramname="url"value="jdbc:mysql://localhost:3306/jackrabbit"/>
<paramname="user"value="pentaho"/>
<paramname="password"value="passwd"/>
<paramname="databaseType"value="mysql"/>
<paramname="driver"value="com.mysql.jdbc.Driver"/>
<paramname="minRecordLength"value="1024"/>
<paramname="maxConnections"value="3"/>
<paramname="copyWhenReading"value="true"/>
<paramname="tablePrefix"value=""/>
<paramname="schemaObjectPrefix"value="ds_repos_"/>
</DataStore>

註解以下標籤和內容:

<FileSystemclass="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<paramname="path"value="${wsp.home}"/>
</FileSystem>

去掉以下標籤和內容註解並修改賬號密碼:

<FileSystemclass="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<paramname="driver"value="com.mysql.jdbc.Driver"/>
<paramname="url"value="jdbc:mysql://localhost:3306/jackrabbit"/>
<paramname="user"value="pentaho"/>
<paramname="password"value="passwd"/>
<paramname="schema"value="mysql"/>
<paramname="schemaObjectPrefix"value="fs_ws_"/>
</FileSystem>

註解以下標籤和內容:

<PersistenceManagerclass="org.apache.jackrabbit.core.persistence.pool.H2PersistenceManager">
<paramname="url"value="jdbc:h2:${wsp.home}/db"/>
<paramname="schemaObjectPrefix"value="${wsp.name}_"/>
</PersistenceManager>

去掉以下標籤和內容註解並修改賬號密碼:

<PersistenceManagerclass="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
<paramname="driver"value="com.mysql.jdbc.Driver"/>
<paramname="url"value="jdbc:mysql://localhost:3306/jackrabbit"/>
<paramname="user"value="pentaho"/>
<paramname="password"value="passwd"/>
<paramname="schema"value="mysql"/>
<paramname="schemaObjectPrefix"value="${wsp.name}_pm_ws_"/>
</PersistenceManager>

註解以下標籤和內容:

<FileSystemclass="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<paramname="path"value="${rep.home}/version"/>
</FileSystem>

去掉以下標籤和內容註解並修改賬號密碼:

<FileSystemclass="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<paramname="driver"value="com.mysql.jdbc.Driver"/>
<paramname="url"value="jdbc:mysql://localhost:3306/jackrabbit"/>
<paramname="user"value="pentaho"/>
<paramname="password"value="passwd"/>
<paramname="schema"value="mysql"/>
<paramname="schemaObjectPrefix"value="fs_ver_"/>
</FileSystem>

註解以下標籤和內容:

<PersistenceManagerclass="org.apache.jackrabbit.core.persistence.pool.H2PersistenceManager">
<paramname="url"value="jdbc:h2:${rep.home}/version/db"/>
<paramname="schemaObjectPrefix"value="version_"/>
</PersistenceManager>

去掉以下標籤和內容註解並修改賬號密碼:

<PersistenceManagerclass="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
<paramname="driver"value="com.mysql.jdbc.Driver"/>
<paramname="url"value="jdbc:mysql://localhost:3306/jackrabbit"/>
<paramname="user"value="pentaho"/>
<paramname="password"value="passwd"/>
<paramname="schema"value="mysql"/>
<paramname="schemaObjectPrefix"value="pm_ver_"/>
</PersistenceManager>

2.6.6 配置Tomcat的JDBC連線資訊context.xml

cd/usr/pentaho/pentaho-server/
cptomcat/webapps/pentaho/META-INF/context.xmltomcat/webapps/pentaho/META-INF/context.xml.default
vimtomcat/webapps/pentaho/META-INF/context.xml

修以下配置:

maxWaitMillis="10000"username="pentaho"password="passwd"
driverClassName="com.mysql.jdbc.Driver"url="jdbc:mysql://localhost/hibernate"
validationQuery="select1"/>

maxWaitMillis="10000"username="pentaho"password="passwd"
driverClassName="com.mysql.jdbc.Driver"url="jdbc:mysql://localhost/quartz"
validationQuery="select1"/>

2.6.7 配置web.xml

cd/usr/pentaho/pentaho-server
cptomcat/webapps/pentaho/WEB-INF/web.xmltomcat/webapps/pentaho/WEB-INF/web.xml.default
vimtomcat/webapps/pentaho/WEB-INF/web.xml

刪除以下標籤和配置:

<!--[BEGINHSQLDBDATABASES]-->
<context-param>
<param-name>hsqldb-databases</param-name>
<param-value>[email protected]/../data/hsqldb/sampledata,[email protected]/../data/hsqldb/hibernate,[email protected]/../data/hsqldb/quartz</param-value>
</context-param>
<!--[ENDHSQLDBDATABASES]-->

刪除以下標籤和配置:

<!--[BEGINHSQLDBSTARTER]-->
<listener>
<listener-class>org.pentaho.platform.web.http.context.HsqldbStartupListener</listener-class>
</listener>
<!--[ENDHSQLDBSTARTER]-->

2.6.8 配置applicationContext-spring-security-hibernate.properties(可選)

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/applicationContext-spring-security-hibernate.propertiespentaho-solutions/system/applicationContext-spring-security-hibernate.properties.defautl
vimpentaho-solutions/system/applicationContext-spring-security-hibernate.properties

修改如下引數:

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/hibernate
jdbc.username=pentaho
jdbc.password=passwd
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

2.6.9 配置applicationContext-spring-security-jdbc.properties(可選)

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/applicationContext-spring-security-jdbc.propertiespentaho-solutions/system/applicationContext-spring-security-jdbc.properties.default
vimpentaho-solutions/system/applicationContext-spring-security-jdbc.properties

修改如下引數:

datasource.driver.classname=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://localhost:3306/hibernate
datasource.username=pentaho
datasource.password=passwd
datasource.validation.query=SELECT1

2.6.10 配置jdbc.properties(可選)

cd/usr/pentaho/data-integration
cpsimple-jndi/jdbc.propertiessimple-jndi/jdbc.properties.default
vimsimple-jndi/jdbc.properties

註釋掉原來引數並增加如下引數且修改賬號密碼:

SampleData/type=javax.sql.DataSource
SampleData/driver=com.mysql.jdbc.Driver
SampleData/url=jdbc:mysql://localhost:3306/hibernate
SampleData/user=pentaho
SampleData/password=passwd
Hibernate/type=javax.sql.DataSource
Hibernate/driver=com.mysql.jdbc.Driver
Hibernate/url=jdbc:mysql://localhost:3306/hibernate
Hibernate/user=pentaho
Hibernate/password=passwd
Quartz/type=javax.sql.DataSource
Quartz/driver=com.mysql.jdbc.Driver
Quartz/url=jdbc:mysql://localhost:3306/quartz
Quartz/user=pentaho
Quartz/password=passwd
Shark/type=javax.sql.DataSource
Shark/driver=com.mysql.jdbc.Driver
Shark/url=jdbc:mysql://localhost:3306/hbibernate
Shark/user=pentaho
Shark/password=passwd
SampleDataAdmin/type=javax.sql.DataSource
SampleDataAdmin/driver=com.mysql.jdbc.Driver
SampleDataAdmin/url=jdbc:mysql://localhost:3306/hibernate
SampleDataAdmin/user=pentaho
SampleDataAdmin/password=passwd

2.6.11 配置pentaho.xml(可選)

cd/usr/pentaho/pentaho-server/
cppentaho-solutions/system/pentaho.xmlpentaho-solutions/system/pentaho.xml.defautl
vimpentaho-solutions/system/pentaho.xml

修改如下配置:

<login-show-users-list>false</login-show-users-list>
<login-show-sample-users-hint>false</login-show-sample-users-hint>

註解或刪除如下配置:

<sampledata-datasource>
<name>SampleData</name>
<host>localhost</host>
<type>Hypersonic</type>
<port>9001</port>
<access>NATIVE</access>
<username>pentaho_user</username>
<password>password</password>
<max-active>20</max-active>
<max-idle>5</max-idle>
<max-wait>1000</max-wait>
<query>selectcount(*)fromINFORMATION_SCHEMA.SYSTEM_SEQUENCES</query>
</sampledata-datasource>

2.7 測試和配置服務啟動

2.7.1 測試服務啟動

sudo-upentaho/usr/pentaho/pentaho-server/tomcat/bin/startup.sh

2.7.2 監視日誌排錯

建議監控如下日誌:

tail-f/usr/pentaho/pentaho-server/tomcat/logs/catalina.out

建議搜尋如下日誌:

grep-i-E"error|fail"/usr/pentaho/pentaho-server/tomcat/logs/catalina.out|sort-u

2.7.3 網頁測試

http://10.168.0.76:8080/pentaho

wKioL1k4yZ6DItO2AACsCSNFvpw190.png

參閱資料:

=================================================

安裝教程:

https://help.pentaho.com/Documentation/7.0


其他參考資料:

http://www.cnblogs.com/driftingshine/p/6065454.html

http://community.pentaho.com/


驅動下載連結:

http://www.oracle.com/technetwork/apps-tech/jdbc-112010-090769.html

http://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html

ojdbcx.jar, ora18n.jar


啟動安裝教程:

https://help.pentaho.com/Documentation/7.0/0D0/160/010#Oracle


LDAP專案:

https://help.pentaho.com/Documentation/7.0/0P0/Setting_Up_User_Security/Implement_Advanced_Security/010

https://help.pentaho.com/Documentation/7.0/0P0/Setting_Up_User_Security/Implement_Advanced_Security/030


下載頁面:

https://sourceforge.net/projects/pentaho/files/


手動LDAP配置:

https://help.pentaho.com/Documentation/7.0/0P0/Setting_Up_User_Security/Implement_Advanced_Security/030

http://diethardsteiner.github.io/biserver/2014/11/08/LDAP.html


切換到LDAP:

https://help.pentaho.com/Documentation/7.0/0P0/Setting_Up_User_Security/Implement_Advanced_Security/010

LDAP介面配置:

https://help.pentaho.com/Documentation/7.0/0P0/Setting_Up_User_Security/Implement_Advanced_Security/010

http://wiki.pentaho.com/display/ServerDoc2x/Using+LDAP+and+JDBC+Simultaneously


Jar下載:

http://mvnrepository.com/


安裝文件:

https://help.pentaho.com/Documentation/7.0/0F0/0P0/Starting_the_Pentaho_Server_after_Manual_Installation

https://help.pentaho.com/Documentation/7.0/0F0/0P0/020/0B0


資料庫配置:

https://help.pentaho.com/Documentation/7.0/0F0/0P0/030/020


轉載於:https://blog.51cto.com/cmdschool/1933360