pentaho开源商业智能平台的搭建(3)
pentaho开源商业智能平台的搭建(3)
pentaho是世界上最流行的开源商务只能软件。它是一个基于java平台的商业智能(Business Intelligence,BI)套件,之所以说是套件是因为它包括一个web server平台和几个工具软件:报表,分析,图表,数据集成,数据挖掘等,可以说包括了商务智能的方方面面。
1.数据库初始化
初始化的工作就是建立相关的库,导入相关的数据。为了测试报表功能,我们还需要有数据源(data source)。
名词解释:
数据源(data source):也就是数据的来源。我们的报表都要由这些数据生成。在基本安装的时候pentaho自带的数据源是HSQL上的名为sampledata的数据库,现在我们需要mysql下的一个库。
pentaho自带了mysql数据库的初始化脚本,首先切换到该目录下:
cd data/mysql5/
然后下载sampledata数据库作数据源用:
wget http://www.prashantraju.com/pentaho/downloads/sampledatamysql5.sql
导入数据脚本(注意次序不能乱)
mysql -uroot -p
mysql -uroot -p
mysql -uroot -p
mysql -uroot -p
各个脚本的功能如下:
表名
功能
create_repository_mysql.sql
创建hibernate数据库
建用户hibuser,密码为password,对库有完全权限
—ATASOURCE表
create_quartz_mysql.sql
创建quartz数据库
建用户pentaho_user,密码为password,对库有完全权限
建了很多QRTZ_开头的表
create_sample_datasource_mysql.sql
向hibernate库的DATASOURCE表里面插入一个记录
数据源即是在这里定义,显示在administration console里面的Data Sources栏目里面
sampledatamysql5.sql
创建sampledata数据库和它的表
用户pentaho_user和pentaho_admin,密码为password,对库有完全权限
这个库就是我们生成报表所用的数据源
完成的上面的工作以后,mysql里面就有了hibernate,quartz和sampledata三个数据库和相应的用户。
2.修改配置文件
对配置文件修改主要是修改里面的数据库连接部分和允许外部访问的部分。
(1)配置目录 pentaho-solutions/
文件路径如下:
pentaho-solutions/
system/
applicationContext-acegi-security-jdbc.xml (要修改)
applicationContext-acegi-security-hibernate.properties (要修改)
hibernate/
hibernate-settings.xml (要修改)
mysql5.hibernate.cfg.xml (做检查,有必要的时候修改)
共有4个文件,下面针对这4个文件的修改分别加以说明:
applicationContext-acegi-security-jdbc.xml
作用:给BI server所用的Spring Security system建立JDBC认证。
修改项目
名称
旧值
新值
driverClassName
(数据库访问的驱动)
org.hsqldb.jdbcDriver
com.mysql.jdbc.Driver
url
(hibernate这个库的url)
jdbc:hsqldb:hsql://localhost:9001/hibernate
jdbc:mysql://localhost:3306/hibernate
username
(访问hibernate库的用户)
hibuser
hibuser
(或root)
password
(访问hibernate库的密码)
password
password
(或root的密码)
applicationContext-acegi-security-hibernate.properties
作用:设置属性参数用于Spring Security来建立数据库与hibernate的连接。
修改项目
名称
旧值
新值
jdbc.driver
org.hsqldb.jdbcDriver
com.mysql.jdbc.Driver
jdbc.url
(hibernate库的url)
jdbc:hsqldb:hsql://localhost:9001/hibernate
jdbc:mysql://localhost:3306/hibernate
jdbc.username
(访问hibernate库的用户)
hibuser
hibuser(或root,但不推荐)
jdbc.password
(访问hibernate库的密码)
password
password(或root的密码,但不推荐)
hibernate.dialect
(数据库用的语言)
org.hibernate.dialect.HSQLDialect
org.hibernate.dialect.MySQLDialect
hibernate-settings.xml
作用:基本的hibernate设置,例如hibernate的数据库后台。
修改项目
名称
旧值
新值
config-file
system/hibernate/hsql.hibernate.cfg.xml
system/hibernate/mysql5.hibernate.cfg.xml
mysql5.hibernate.cfg.xml
作用:配置hibernate数据库的mysql连接,这样就允许BI server内部的管理连接。
因为这个配置文件已经是针对mysql的了,,所以不需要修改,只是要检查确认。
名称
值
connection.driver_class
com.mysql.jdbc.Driver
connection.url
jdbc:mysql://localhost:3306/hibernate
connection.username
hibuser(可以改为root,但不推荐)
connection.password
password((可以改为root的密码,但不推荐)
(2) 配置目录tomcat/webapps/pentaho/
这是做修改网页相关的配置。
要修改的文件路径如下:
tomcat/
webapps/
pentaho/
WEB-INF/
web.xml
META-INF/
context.xml
下面对这2个文件分别说明:
web.xml
作用:tomcat的pentaho站点启动的主配置文件,如建立所有的JSP和其他各种文件。
修改项目
名称
旧值
新值
base-url
http://localhost:8080/pentaho/
将localhost保留或改为实际ip
如果是localhost,那么仅能从本机登录才能打开sampledata报表,如果是实际ip。那样就能从别的机器登录了。
作用:建立hibernate和quartz两者的配置文件。
做如下修改:
对于Resource name="jdbc/Hibernate"
username
更新为hibuser(或者root)
password
更新为password(或者root的密码 )
driverClassName
更新为com.mysql.jdbc.Driver
url
更新为jdbc:mysql://localhost/hibernate (需要的时候localhost后加端口号)
validationQuery
删掉这个值,或者填SELECT 1 (这个值是检查库是否可用的SQL查询)
对于Resource name="jdbc/Quartz"
username
更新为pentaho_user (或者root)
password
更新为password(或者root的密码 )
driverClassName
更新为com.mysql.jdbc.Driver
url
更新为jdbc:mysql://localhost/quartz (需要的时候localhost后加端口号)
validationQuery
删掉这个值,或者填SELECT 1 (这个值是检查库是否可用的SQL查询)
配置文件的修改就完成了,启动user console和administration console吧!
http://sysapp.51cto.com/art/200904/121222_1.htm