Pentaho3.6.0.RC1でMySQLを使用するよう設定する

メモ:  Category:windows

展開したPentahoには、複数のデータベースに対応できるようスクリプトが用意されています。(biserver-ce\data)

用意されているデータベース:

  • MySQL5
  • Oracle10g
  • PostgreSQL

ここでは、MySQL5を使うよう設定していきますが付属のスクリプトではなく、別のスクリプトを使用します。

データベースの設定ドキュメントがなかなか見つけられなかったのですが、**Pentaho - Projects - Analyse This**というサイトを参考に設定を行います。

このサイトには、MySQL5.x,PostgreSQL 8.x.x,Oracle XE, 10g & 11gの設定方法が用意されています。

関連:WindowsへMySQL5.0.16をインストールする

Pentahoのデータベース設定

データベース環境の作成

ここからの作業は、ほぼドキュメント通り進めていきます。

**Pentaho - Projects - Analyse This**からMySQL用のSQL Packをダウンロードしc:\pentaho\biserver-ce\data\mysql5\へ展開します。

インストールしたMySQLへユーザーとデータベースを作成するよう次のスクリプトを実行します。

> mysql -u root -p

> source c:\pentaho\biserver-ce\data\mysql5\1_create_repository_mysql.sql

これにより、データベースユーザーhibuserとデータベースhibernateが作成され、datasourceテーブル等が作成されます。

次にスケジューラー用のデータベースを作成します。

> source c:\pentaho\biserver-ce\data\mysql5\2_create_quartz_mysql.sql

Pentaho付属のサンプルデーターへ接続できるよう、データーソースを追加します。

> source c:\pentaho\biserver-ce\data\mysql5\3_create_sample_datasource_mysql.sql

これにより、datasourceテーブルへデータベースへの接続設定が追加されます。

4つ目のスクリプトでは、サンプルユーザーを追加します。

> source c:\pentaho\biserver-ce\data\mysql5\4_load_sample_users_mysql.sql

最後のスクリプトを実行します。

> source c:\pentaho\biserver-ce\data\mysql5\5_sampledata_mysql.sql

これにより、データベースhibernateとユーザーpentaho_user,pentaho_adminが作成され、複数のテーブルとデータが作成されます。

JDBC Securityの設定

pentaho-solutions\system\フォルダにあるpplicationContext-spring-security-jdbc.xmlを次のように修正します。

<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>

driverClassNameとurlをMySQL用に修正します。

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.MySQLDialect

pentaho-solutions\system\hibernate\フォルダにあるhibernate-settings.xmlを次のように修正します。

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

Hibernate及びQuartzデータベースへの接続設定

MySQLへ作成したhibernateおよびquartzデータベースへ接続できるよう接続情報を修正します。

biserver-ce\tomcat\webapps\pentaho\META-INF\フォルダにあるcontext.xmlを次のように修正します。

<?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="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>

Pentahoの環境設定

ソリューションのパスをc:\pentahoへ変更します。biserver-ce\pentaho-solutionsをc:\pentahoへ移動します。

C:\pentaho
     |
     |-- \pentaho-solutions

ソリューションのパスを変更したため、 \tomcat\webapps\pentaho\WEB_INF\フォルダにあるweb.xmlを次のように修正します。

<context-param>
    <param-name>solution-path</param-name>
    <param-value>C:\pentaho\pentaho-solutions</param-value>
</context-param>

次にbase-urlを変更します。デフォルトではlocalhostとなっていいるためドメイン名かIPアドレスへ変更します。

<param-name>base-url</param-name>
<param-value>http://192.168.1.10:8080/pentaho/</param-value>

Pentahoの管理コンソールをリモートで使う場合、次の設定項目にそのIPアドレスを追加します。

<param-name>TrustedIpAddrs</param-name>
<param-value>127.0.0.1,[IPアドレスをカンマ区切りで指定]</param-value>

Pentahoで使用するメールサーバーの設定

SMTPサーバーの設定を\pentaho-solutions\system\フォルダにあるsmtp-email.xmlに追加します。

<email-smtp>
    <properties>
        <mail.smtp.host>SMTPサーバー</mail.smtp.host>
        <mail.smtp.port>25</mail.smtp.port>
        <mail.transport.protocol>smtp</mail.transport.protocol>
        <mail.smtp.starttls.enable>false</mail.smtp.starttls.enable>
        <mail.smtp.auth>false</mail.smtp.auth>
        <mail.smtp.ssl>false</mail.smtp.ssl>
        <mail.smtp.quitwait>false</mail.smtp.quitwait>
   </properties>
    <mail.pop3></mail.pop3>
    <mail.from.default>pentahoadmin@gmail.com</mail.from.default>
    <mail.userid></mail.userid>
    <mail.password></mail.password>
</email-smtp>

Pentahoの動作確認

c:\pentaho\biserver-ce\start-pentaho.batを実行してPentahoを起動します。ブラウザからアクセスしサンプルが表示されることを確認します。

Pentahoへログイン後の画面

管理コンソールの設定

C:\pentaho\administration-console\start-pac.batを実行し、ブラウザからhttp://localhost:8099/ へアクセスすると次のエラーが表示されました。(ユーザー:admin,パスワード:password)

Administration Console configuration is not valid.
Please correct the configuration in console.xml and restart administration console.

C:\pentaho\administration-console\resource\configフォルダにあるconsole.xmlに変更後のソリューションパスとPentahoの配置先を追加します。

<solution-path>c:\pentaho\pentaho-solutions</solution-path>
<war-path>C:\pentaho\biserver-ce\tomcat\webapps\pentaho</war-path>

以上で設定が完了します。

bluenote by BBB