Introduction
Pentaho Analysis Services is called Mondrian, which is the name I’ll use for the remainder of this post. Mondrian is Pentaho’s OLAP server.
In this post I’ll provide step-by-step instructions on how to install Mondrian 3.4.1 Ubuntu Linux 12.04 LTS x64. We’ll use MySQL as the database.
Download
Let’s first create a directory to download Mondrian into.
mkdir -p ~/Downloads/pentaho/analysis
cd ~/Downloads/pentaho/analysis
To download the Mondrian either run the following command, or follow the 3 bulleted steps below.
wget http://hivelocity.dl.sourceforge.net/project/mondrian/mondrian/mondrian-3.4.1/mondrian-3.4.1.zip
Or follow the steps below if you don’t want to use the wget command shown above.
- Download Mondrian 3.4.1 from http://wiki.pentaho.com/display/COM/Latest+Stable+Builds.
- Click mondrian-3.4.1.
- Click mondrian-3.4.1.zip to download Mondrian.
Unzip
cd ~/Downloads/pentaho/analysis
unzip mondrian-3.4.1.zip
Install the Mondrian Server
cd ~/Downloads/pentaho/analysis/mondrian-3.4.1/lib
sudo unzip mondrian.war -d /opt/pentaho/biserver-ce/tomcat/webapps/mondrian
sudo chown -R pentaho:pentaho /opt/pentaho/biserver-ce/tomcat/webapps/mondrian
Create the FoodMart Database
FoodMart is a sample database that can be used to learn Mondrian.
mysql -u root -p
Enter the following commands at the MySQL command prompt.
mysql> CREATE DATABASE foodmart;
Please use a real password by changing pass.word below.
mysql> GRANT ALL ON foodmart.* TO foodmart@localhost IDENTIFIED BY 'pass.word';
mysql> quit;
Import the Foodmart Schema and Data
cd /opt/pentaho/biserver-ce/tomcat/webapps/mondrian
Important
Change akbar to your user name in the inputFile option in the command below.
java -cp "\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/mondrian.jar:\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/log4j-1.2.8.jar:\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/commons-collections-3.1.jar:\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/olap4j.jar:\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/commons-logging-1.0.4.jar:\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/eigenbase-xom.jar:\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/eigenbase-resgen.jar:\ /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/lib/eigenbase-properties.jar:\ /opt/pentaho/biserver-ce/tomcat/lib/mysql-connector-java-5.1.17.jar" \ mondrian.test.loader.MondrianFoodMartLoader -verbose -tables -data -indexes \ -jdbcDrivers=com.mysql.jdbc.Driver \ -inputFile=/home/akbar/Downloads/pentaho/analysis/mondrian-3.4.1/demo/FoodMartCreateData.sql \ -outputJdbcURL="jdbc:mysql://localhost/foodmart?user=foodmart&password=pass.word"
If you get an error, there is a 99% probability that the jar files cannot be found on the paths specified in the command above. So, the first thing you should do is check if the jar files can be found in the class path paths that are listed above, then update the paths as necessary.
Update the Sample MDX Query Files
cd /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF/queries
Edit each of the following files and make the change shown in the From / To instructions below.
Change each of the JSP files from:
<jp:mondrianQuery id="query01" jdbcDriver="org.apache.derby.jdbc.EmbeddedDriver" jdbcUrl="jdbc:derby:classpath:/foodmart" catalogUri="/WEB-INF/queries/FoodMart.xml"
jdbcUser="sa" jdbcPassword="sa" connectionPooling="false">
To…
<jp:mondrianQuery id="query01" jdbcDriver="com.mysql.jdbc.Driver" jdbcUrl="jdbc:mysql://localhost/foodmart?user=foodmart&password=pass.word" catalogUri="/WEB-INF/queries/FoodMart.xml">
sudo vi fourhier.jsp
sudo vi mondrian.jsp
sudo vi arrows.jsp
sudo vi colors.jsp
cd /opt/pentaho/biserver-ce/tomcat/bin
sudo ./shutdown.sh
sudo ./startup.sh
I have changed the default Pentaho BI Server port from 8080 to 8585.
Open a web browser to http://localhost:8585/mondrian.
Click each of the links below to view the same cube.
The cube will be populated for the first time when you click the first link below. In other words, the first page will take a long time to load while the cube is populating. On my system, I actually had to reboot and restart Tomcat before the pages displayed.
Mondrian Configuration Files
Nothing needs to be done to setup the FoodMart database, however you will need to edit the following configuration files when you create your own database.
mondrian.properties
cd /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF
sudo cp mondrian.properties mondrian.properties.org
sudo vi mondrian.properties
datasources.xml
cd /opt/pentaho/biserver-ce/tomcat/webapps/mondrian/WEB-INF
sudo cp datasources.xml datasources.xml.org
sudo vi datasources.xml
Debugging
I was initially using the instructions at http://mondrian.pentaho.com/documentation/installation.php, however, I got the following error when I ran the jar command.
Exception in thread "main" java.lang.NoClassDefFoundError: org/olap4j/mdx/IdentifierSegment at mondrian.test.loader.MondrianFoodMartLoader.(MondrianFoodMartLoader.java:98) Caused by: java.lang.ClassNotFoundException: org.olap4j.mdx.IdentifierSegment at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 1 more Could not find the main class: mondrian.test.loader.MondrianFoodMartLoader. Program will exit.
The solution was to add the following missing .jar files to the class path:
- commons-collections-3.1.jar
- olap4j.jar
Image may be NSFW.
Clik here to view.
Clik here to view.
