天天看點

讓SaiKu實時展現查詢資料

在預設的情況下,saiku是不能對資料進行實時展現的,隻能通過下圖的重新整理按鈕或者重新開機伺服器來重新整理資料

讓SaiKu實時展現查詢資料

這樣以來會有很多的麻煩,每天得手動去重新整理,這個操作隻有管理者可以操作,在重新整理以前客戶看到的都是緩存中的舊資料,有人說寫個shell去定時更新不行嗎?這個做法當然可以。除了這個做法,我來說說我的做法,讓saiku查詢完資料後即時加載,不用資料庫連接配接池,加載完成後立刻清除緩存中的資料,系統下次在加載的時候發現緩存是空的,就會自動去查詢新資料,這樣以來就可以做到實時展現,具體修改如下:

編輯 saiku/ui/js/saiku/Settings.js

LOCALSTORAGE_EXPIRATION: 10 * 60 * 60 * 1000 /* 10 hours, in ms */      

修改後

LOCALSTORAGE_EXPIRATION: 1      

編輯 saiku/plugin.spring.xml

<bean id="connectionManager" class="org.saiku.plugin.PentahoSecurityAwareConnectionManager" init-method="init"  destroy-method="destroy"><property name="dataSourceManager" ref="pentahoDsManager" /><property name="userAware" value="false" /><property name="connectionPooling" value="true" /></bean>      
<bean id="connectionManager" class="org.saiku.plugin.PentahoSecurityAwareConnectionManager" init-method="init"  destroy-method="destroy"><property name="dataSourceManager" ref="pentahoDsManager" /><property name="userAware" value="false" /><property name="connectionPooling" value="false" /></bean>      

編輯mondrian/mondrian.properties

修改前

# Boolean property that controls whether a RolapStar's aggregate data cache is cleared after each query.
mondrian.rolap.star.disableCaching=false      
# Boolean property that controls whether a RolapStar's aggregate data cache is cleared after each query.
mondrian.rolap.star.disableCaching=true