bi server
版本约定
- BI Server版本:5.4.0.1,下载地址:http://sourceforge.net/projects/pentaho/files/Business%20Intelligence%20Server/5.4/
-
操作系统:Centos6.5 x64系统,IP地址:10.100.3.73。
- JDK版本:JDK1.7或以上
- MySQL版本:MySQL5.1.17
配置YUM源
yum源主要为安装jdk和mysql时使用,我们在10.100.3.37机器上已经有相关yum源直接配置yum源文件即可。
$ cd /etc/yum.repos.d/ $ rm -rf * #删除无用配置yum源文件 $ vi ftp-server.repo #加入ftp-server.repo文件加入如下配置: [base] name=ftp-server baseurl=ftp://10.100.3.37/pub/ gpgcheck=0 |
JDK安装
-
首先检查机器是否安装过OpenJDK,如果有安装过,先卸载。
$ rpm -qa | grep jdk $ rpm -e xxx #xxx为上一步输出的rpm包
-
在机器上安装JDK并配置JAVA_HOME。执行命令:
$ yum install jdk $ vi /etc/profile #加入如下配置 export JAVA_HOME=/usr/java/jdk1.7.0_80 export PATH=$JAVA_HOME/bin:$JAVA_HOME/lib:$PATH #使配置生效 $ source /etc/profile
安装MySQL
安装MySQL主要是为了方便管理BI Server的配置数据。BI Server默认使用hsqldb来管理配置数据,不方便管理和迁移,我们需要迁移到MySQL中。
-
yum安装,执行命令:
$ yum install mysql mysql-devel mysql-server #安装后启动mysql服务 $ service mysqld start
-
配置mysql数据库。
[mysqld] transaction-isolation=READ-COMMITTED # Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: # symbolic-links=0 key_buffer = 16M key_buffer_size = 32M max_allowed_packet = 16M thread_stack = 256K thread_cache_size = 64 query_cache_limit = 8M query_cache_size = 64M query_cache_type = 1 # Important: see Configuring the Databases and Setting max_connections max_connections = 550 # log-bin should be on a disk with enough free space #log-bin=/x/home/mysql/logs/binary/mysql_binary_log # For MySQL version 5.1.8 or later. Comment out binlog_format for older versions. #binlog_format = mixed read_buffer_size = 2M read_rnd_buffer_size = 16M sort_buffer_size = 8M join_buffer_size = 8M # InnoDB settings default-storage-engine =innodb innodb_file_per_table = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 64M innodb_buffer_pool_size = 2G innodb_thread_concurrency = 8 innodb_flush_method = O_DIRECT innodb_log_file_size = 512M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
重启MySQL服务,不报错表示配置成功。
-
配置MySQL账号密码。
$ /usr/bin/mysql_secure_installation [...] Enter current password for root (enter for none): OK, successfully used password, moving on... [...] Set root password? [Y/n] y New password: Re-enter new password: Remove anonymous users? [Y/n] Y [...] Disallow root login remotely? [Y/n] N [...] Remove test database and access to it [Y/n] Y [...] Reload privilege tables now? [Y/n] Y All done!
BI Server安装
-
解压biserver安装文件包:
unzip biserver-ce-5.4.0.1-130.zip chmod +x -R biserver-ce
-
配置tomcat中的web.xml文件使其它机器可以访问biserver:
cd ./biserver-ce/tomcat/webapps/pentaho/WEB-INF vi web.xml #修改以下字段 <context-param> <param-name>fully-qualified-server-url</param-name> <!--原配置 --> <!-- <param-value>http://localhost:8080/pentaho</param-value> --> <!--现配置--> <param-value>http://10.100.3.73:8080/pentaho</param-value> <context-param>
-
启动基于hsqldb数据的biserver,查看是否正常。
cd biserver-ce ./start-pentaho.sh
等待几分钟,在浏览器上输入http://10.100.3.73:8080。正常打开表示成功。如果出错可以在biserver-ce/tomcat/logs中查看错误日志,解决异常后重试即可。
配置数据迁移到MySQL
-
修改/biserver-ce/data/mysql5中3个sql脚本,把建库脚本的编码格式由latin1改为utf8,并在mysql中执行这3个脚本文件。
sed -i 's#latin1#utf8#g' /root/biserver-ce/data/mysql5/create_jcr_mysql.sql sed -i 's#latin1#utf8#g' /root/biserver-ce/data/mysql5/create_quartz_mysql.sql sed -i 's#latin1#utf8#g' /root/biserver-ce/data/mysql5/create_repository_mysql.sql mysql -p <create_icr_mysql.sql mysql -p <create_quartz_mysql.sql mysql -p <create_repository_mysql.sql
-
修改/biserver-ce/pentaho-solutions/system/applicationContext-spring-security-jdbc.properties文件。
#把文件中的参数修改为如下选项 datasource.driver.classname=com.mysql.jdbc.Driver datasource.url=jdbc:mysql://localhost:3306/hibernate datasource.username=root datasource.password=root datasource.validation.query=SELECT 1
-
修改/biserver-ce/pentaho-solutions/system/applicationContext-spring-security-hibernate.properties文件。
#把文件中的参数修改为如下 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/hibernate jdbc.username= hibuser jdbc.password= password hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
-
修改/biserver-ce/pentaho-solutions/system/hibernate/hibernate-settings.xml文件。
#修改config-file标签 <config-file>system/hibernate/mysql5.hibernate.cfg.xml</config-file>
-
修改/biserver-ce/pentaho-solutions/system/quartz/quartz.properties文件
#修改如下参数 org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
-
修改/biserver-ce/tomcat/webapps/pentaho/META-INF/context.xml文件
#注意参数,修改driverClassName,url,validationQuery标签 <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"/>
- 删除/biserver-ce/tomcat/conf/Catalina/localhost/pentaho.xml文件,该文件在启动tomcat时会自动创建。
-
修改/biserver-ce/tomcat/webapps/pentaho/WEB-INF/web.xml文件,停用默认的hsqldb。
#注释掉以下内容 <!--context-param> <param-name>hsqldb-databases</param-name> <param-value>sampledata@../../data/hsqldb/sampledata,hibernate@../../data/hsqldb/hibernate,quartz@../../data/hsqldb/quartz</param-value> </context-param--> <!--listener> <listener-class>org.pentaho.platform.web.http.context.HsqldbStartupListener</listener-class> </listener-->
- 替换tomcat中连接mysql的jar包,驱动下载地址:http://dev.mysql.com/downloads/connector/j/5.1.html。替换/biserver-ce/tomcat/lib/mysql-connector-java-5.1.17.jar.
-
创建样本数据,在pentaho5.4.0.1版本中并没有样本数据,需要手动下载,见下面文件sampledata_mysql.sql。在mysql中执行改脚本。
mysql -p <sampledata_mysql.sql
-
修改/biserver-ce/pentaho-solutions/system/simple-jndi/jdbc.properties文件。
#注意对比文件内容 SampleData/type=javax.sql.DataSource SampleData/driver=com.mysql.jdbc.Driver SampleData/url=jdbc:mysql://localhost:3306/sampledata SampleData/user=pentaho_user SampleData/password=password Hibernate/type=javax.sql.DataSource Hibernate/driver=com.mysql.jdbc.Driver Hibernate/url=jdbc:mysql://localhost:3306/hibernate Hibernate/user=hibuser Hibernate/password=password Quartz/type=javax.sql.DataSource Quartz/driver=com.mysql.jdbc.Driver Quartz/url=jdbc:mysql://localhost:3306/quartz Quartz/user=pentaho_user Quartz/password=password Shark/type=javax.sql.DataSource Shark/driver=com.mysql.jdbc.Driver Shark/url=jdbc:mysql://localhost:3306/shark Shark/user=sa Shark/password= SampleDataAdmin/type=javax.sql.DataSource SampleDataAdmin/driver=com.mysql.jdbc.Driver SampleDataAdmin/url=jdbc:mysql://localhost:3306/sampledata SampleDataAdmin/user=pentaho_admin SampleDataAdmin/password=password
-
启动biserver。
sh ./start-pentaho.sh
不出意外biserver将正常启动。
- 修改sampleData的连接。
登陆pentaho主界面,选择菜单File->New-DataSource
弹出Data Source Wizard
SourceType中选择Database Table(s),选择SampleData,点击EditConnection图表。
修改SampleData的连接属性如下图:
修改完点击OK即可。