Saiku_學習_01_saiku安裝與運行


 一、下載saiku

1.下載地址

官網:https://community.meteorite.bi/

 

 

 

 2.解壓后文件結構

 

3.ROOT和saiku

 在tomcat/webapp 下有兩個web應用,是與saiku相關的。

 

 

將環境變量中的CATALINA_HOME設置為這里的tomcat,

然后運行saiku-server下的start-saiku.bat

訪問 localhost:8080/upload.html ,可以看到一個讓你上傳license的頁面,如下圖:

 

4.獲取license文件

前往  https://licensing.meteorite.bi/login  ,注冊賬號並進行登錄。

 

創建公司,然后創建license,在下載license文件

 

5.上傳license

前往 localhost:8080/upload.html  ,將 4 中下載的license文件上傳。

上傳時需要的賬號:admin ,admin

 

6.登錄saiku

前往 localhost:8080  ,輸入admin,admin  ,即可登錄saiku 系統。

 

二、創建數據庫與數據庫驅動

1.創建數據庫

(1)新建一個數據庫,數據庫名稱為:sakiu_demo(原諒我創建數據庫的時候粗心把saiku打成sakiu了)。

(2)新建一個查詢,運行以下sql語句,來建表和導入數據

 

建表和導入數據的sql語句太大上傳不了,請移步:saiku安裝部署資源

 

2.添加數據庫驅動

下載相應的數據庫驅動放到 saiku-server/tomcat/webapps/saiku/WEB-INF/lib 目錄下

 

三、添加 schema

1.新建 sales_mondrian_schema.xml

(1)在 saiku-server\tomcat\webapps\saiku\WEB-INF\classes 路徑下新建saiku-datasources文件夾

 

 (2)在 saiku-datasources文件夾下新建sales_mondrian_schema.xml,文件內容如下

<Schema name="Sauce Dallas schema">
  <Cube name="Sales" visible="true" description="sales cube or Sauce Dallas" cache="true" enabled="true">
    <Table name="fact_sales">
    </Table>
    <Dimension type="StandardDimension" visible="true" foreignKey="customer_id" highCardinality="false" name="customers dimension" caption="customers">
      <Hierarchy name="h_region" visible="true" hasAll="true" allMemberName="All" allLevelName="all levels" primaryKey="customer_id" caption="region" description="regions hierarchy">
        <Table name="dim_customers" alias="customers dimension">
        </Table>
        <Level name="continent" visible="true" column="continent" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="continent">
        </Level>
        <Level name="country" visible="true" column="country" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="country">
        </Level>
        <Level name="state" visible="true" column="state" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="state">
        </Level>
        <Level name="city" visible="true" column="city" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="city">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" visible="true" foreignKey="product_code" highCardinality="false" name="product" caption="product">
      <Hierarchy name="h_product" visible="true" hasAll="true" allMemberName="all products" allLevelName="all levels" primaryKey="product_code" caption="products" description="products hierarchy">
        <Table name="dim_products" alias="products dimension">
        </Table>
        <Level name="product type" visible="true" column="product_type" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="product type" description="product types">
        </Level>
        <Level name="product code" visible="true" column="product_code" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="product code" description="product code">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="TimeDimension" visible="true" foreignKey="date_id" highCardinality="false" name="time dimension" caption="time">
      <Hierarchy name="h_month" visible="true" hasAll="true" allMemberName="all years" allLevelName="all" primaryKey="date_id" caption="months hierarchy" description="months hierarchy">
        <Table name="dim_time" alias="time dimension">
        </Table>
        <Level name="year" visible="true" column="year" type="String" uniqueMembers="false" levelType="TimeYears" hideMemberIf="Never" caption="year">
        </Level>
        <Level name="quarter" visible="true" column="quarter" type="String" uniqueMembers="false" levelType="TimeQuarters" hideMemberIf="Never" caption="quarter">
        </Level>
        <Level name="month" visible="true" column="month_number" nameColumn="month_long_name" type="Integer" uniqueMembers="true" levelType="TimeMonths" hideMemberIf="Never" caption="month">
        </Level>
      </Hierarchy>
    </Dimension>
    <Measure name="sales amount" column="amount" datatype="Numeric" formatString="#,### $" aggregator="sum" visible="true">
    </Measure>
    <Measure name="quantity" column="quantity" datatype="Integer" aggregator="sum" visible="true">
    </Measure>
  </Cube>
</Schema>
View Code

 

2.添加 schema

按下圖步驟,將sales_mondrian_schema.xml上傳,Schema Name 隨意取

 

 

 

四、配置數據源

 

 

 1.配置數據源

type=OLAP
name=sakiu_demo
driver=mondrian.olap4j.MondrianOlap4jDriver
location=jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/sakiu_demo;Catalog=res:saiku-datasources/sales_mondrian_schema.xml;JdbcDrivers=com.mysql.jdbc.Driver;
username=root password=123
security.enabled=false

 

2.配置說明

type=OLAP  :     指定一個 OLAP 引擎.沒有見過非OLAP的屬性值。
name       :     給你的數據源命名,隨意命名。
driver     :     指定 Mondrian driver(將二維關系表轉化為多維度表的驅動).沒有見過其他的屬性值。
location   :      這個屬性有幾個部分組成,使用分號分隔。
             jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/sakiu_demo;    指定數據庫對應jdbc url,需要修改主機和對應的數據庫名稱。這里的主機是localhost,對應數據庫是sakiu_demo
Catalog=res:saiku-datasources/sales_mondrian_schema.xml 指定mondrian schema文件。res表明是文件的路徑,這里是從saiku webapp目錄開始;
JdbcDrivers=com.mysql.jdbc.Driver 指明java 類文件作為數據庫連接驅動。
username : 連接數據庫的用戶名
password : 連接數據庫的密碼

 

 

3.pgsql

type=OLAP
name=postgres
driver=mondrian.olap4j.MondrianOlap4jDriver
location=jdbc:mondrian:Jdbc=jdbc:postgresql://192.168.11.197:5432/postgres;Catalog=res:saiku-datasources/bgt_amount.xml;JdbcDrivers=org.postgresql.Driver;
username=postgres
password=postgres
security.enabled=false

 

 

 

 

五、重新登錄

 需要登錄項目,才能在新建查詢選擇剛剛添加的數據源對應的cube。先注銷,再登錄。如下圖

 

至此就可以很方便的對數據庫中數據進行多維分析了

 

 

 

六、參考資料

精選:

1.saiku安裝方法總結

 

其他:

1.[saiku] 在 Tomcat 下部署 saiku

2.saiku安裝

3.在Tomcat上安裝部署SAIKU

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM