zoukankan      html  css  js  c++  java
  • Saiku缓存处理(七)

    Saiku缓存处理方案

    Saiku默认是从缓存中读取数据的(如果缓存中有数据的话),所以用户看到的数据不一定是最新的,如果需要看到最新的的数据需要手动刷新数据或者更改配置信息。

    Saiku获取实时数据的方案有以下三种。

    >>>获取saiku实时数据方案一:通过admin点击刷新按钮刷新缓存

    以管理员 admin的身份登录saiku,点击新建查询进入页面后会看到一个刷新按钮,点击这个按钮就能刷新缓存了。(这种方案不推荐,因为会比较麻烦,每次都用管理员去登录系统操作。)

    >>>获取saiku实时数据方案二:通过更改配置文件mondrian.properties不使用缓存

    修改配置文件 mondrian.properties  (文件路径:saiku-server omcatwebappssaikuWEB-INFclassesmondrian.properties )

    将注释打开,并修改 mondrian.rolap.star.disableCaching的值为true,表示不使用缓存(这种方案不推荐,因为数据量大的时候会导致saiku使用性能没那么好。)

    ###############################################################################
    # Boolean property that controls whether a RolapStar's
    # aggregate data cache is cleared after each query.
    # If true, no RolapStar will cache aggregate data from one
    # query to the next (the cache is cleared after each query).
    #
    #mondrian.rolap.star.disableCaching=false  

    修改之后的mondrian.properties关于缓存的配置

    ###############################################################################
    # Boolean property that controls whether a RolapStar's
    # aggregate data cache is cleared after each query.
    # If true, no RolapStar will cache aggregate data from one
    # query to the next (the cache is cleared after each query).
    #
    mondrian.rolap.star.disableCaching=true
    

      

    >>> 获取saiku实时数据方案三:通过编写脚本指定saiku刷新缓存

    定时手动刷新saiku缓存信息,也就是通过编写脚本让saiku在指定时间执行刷新(这个脚本的来源 主要参考方案一点击刷新时发送的请求) (推荐使用)

    建议可以在数据库中数据有变化是时,执行此脚本(例如在[ETL]抽完数之后执行)

    新建脚本内容如下:  saiku_refresh.sh

    #!/bin/bash
    
    curl -c ./cookie.txt -d "language=zh&password=admin&username=admin" http://10.22.33.44:8080/saiku/rest/saiku/session
    curl -b ./cookie.txt "http://10.22.33.44:8080/saiku/rest/saiku/admin/discover/refresh"      

    其中  10.22.33.44:8080  #是我安装的saiku的访问地址

    curl -c ./cookie.txt -d "language=zh&password=admin&username=admin"  http://10.22.33.44:8080/saiku/rest/saiku/session   #获取cookies信息,没有指定saiku可以无密码登录的时候需要执行password与username

    curl -b ./cookie.txt "http://10.22.33.44:8080/saiku/rest/saiku/admin/discover/refresh"    #这是主要的执行刷新操作的语句啦

    ps:注意上方的 password username 一定是saiku本身的密码以及用户信息哦!!!(因为如果你的登录接口除了使用saiku本身的校验还调用了其他接口WS类似的接口校验,只能使用saiku本身的用户及密码信息刷新哦!!!!)

    最后通过 sh saiku_refresh.sh  执行此脚本,便能实现刷新换缓存中的数据啦!!!

  • 相关阅读:
    python网络编程学习笔记(3):socket网络服务器
    Python编码爬坑指南
    ROT13 维基百科,自由的百科全书
    ZODB + Traversal Wiki Tutorial¶
    ZODB programming guide¶
    利用新浪api获取ip归属地 QtSharp 博客园
    用python做了个桌球瞄准器
    Python运维工具介绍1–fabric
    python httplib2 使用代理出错
    第四回 基类中的修饰符,应该根据你对架构的理解去定义它们,没有绝对的
  • 原文地址:https://www.cnblogs.com/DFX339/p/10417790.html
Copyright © 2011-2022 走看看