zoukankan      html  css  js  c++  java
  • 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 omcatwebappssaikuWEB-INFclasses 路径下新建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

  • 相关阅读:
    自定义控制器的View(loadView)及其注意点
    多控制器之UIWindow
    多控制器之UIApplication
    浅谈Xcode5和Xcode7在系统创建的文件夹和文件中的区别
    自动计算label字体的高度和图片拉伸处理(封装成分类分享)
    左滑功能和多选功能(在一些列表都会用到的功能)
    数据刷新
    字典转模型第三方框架---MJExtension
    UI之UItableView重用机制的性能问题
    如何设置苹果电脑自带的wife连接手机
  • 原文地址:https://www.cnblogs.com/shirui/p/8573491.html
Copyright © 2011-2022 走看看