您好,登錄后才能下訂單哦!
這篇文章主要介紹了多維數(shù)據(jù)分析引擎Saiku怎么安裝使用,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
一、Saiku的下載安裝和啟動(dòng)
下載地址:
https://community.meteorite.bi/
下載后解壓,即完成安裝。
修改環(huán)境變量為安裝目錄下的tomcat目錄:
CATALINA_HOME = D:\yizit\software\saiku-server\tomcat
執(zhí)行start-saiku.bat啟動(dòng)saiku,啟動(dòng)后命令行窗口不能關(guān)閉。命令窗口中文亂碼情況,需要修改start-saiku.bat文件,將UTF-8更改為GBK。
在瀏覽器地址欄輸入http://localhost:8080/upload.html,出現(xiàn)以下要求上傳License的頁面
License獲取網(wǎng)址:https://licensing.meteorite.bi/login
先點(diǎn)擊sign up進(jìn)行用戶注冊,注冊后收到確認(rèn)郵件,在郵件里點(diǎn)擊進(jìn)入License獲取頁面
先創(chuàng)建公司,再創(chuàng)建License,將生成的License保存到本地文件。
在上傳License頁面將License文件上傳,需要帳戶admin,admin。
前往localhost:8080,輸入admin,admin,即可進(jìn)入Saiku系統(tǒng)。
二、使用示例
將需要的數(shù)據(jù)庫驅(qū)動(dòng)jar包復(fù)制到D:\yizit\software\saiku-server\tomcat\webapps\saiku\WEB-INF\lib目錄下,這里連接的是Oracle數(shù)據(jù)庫。
一個(gè)最為簡單的例子是直接使用Oracle數(shù)據(jù)庫里自帶的SCOTT用戶,對員工表EMP和部門表DEPT構(gòu)建模型,模式文件如下:
<Schema name="scott">
<Cube name="Cube_scott" visible="true" cache="true" enabled="true">
<Table name="EMP" schema="SCOTT">
</Table>
<Dimension type="StandardDimension" visible="true" foreignKey="DEPTNO" highCardinality="false" name="Dim_dept" caption="部门维度">
<Hierarchy visible="true" hasAll="true" primaryKey="DEPTNO">
<Table name="DEPT" schema="SCOTT">
</Table>
<Level name="Level_deptno" visible="true" table="DEPT" column="DEPTNO" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="部门编号">
</Level>
<Level name="Level_deptname" visible="true" column="DNAME" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="部门名称">
</Level>
<Level name="Level_loc" visible="true" column="LOC" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="所在地区">
</Level>
</Hierarchy>
</Dimension>
<Measure name="SalAmount" column="SAL" aggregator="sum" caption="工资总额" visible="true">
</Measure>
<Measure name="EmpQuantity" column="EMPNO" aggregator="count" caption="员工数量" visible="true">
</Measure>
</Cube>
</Schema>
在Saiku中查詢展示結(jié)果
下面再搭建一個(gè)典型的測試用例:
1、數(shù)據(jù)庫表準(zhǔn)備
創(chuàng)建表空間
create tablespace sales_tbs datafile 'd:\oradata\mes\sales_tbs01.dbf' size 100m;
創(chuàng)建用戶并授權(quán)
create user sales identified by sales default tablespace sales_tbs;
grant connect, resource to sales;
alter user sales quota unlimited on sales_tbs;
創(chuàng)建表,插入測試數(shù)據(jù)
/**產(chǎn)品類別表*/
create table protype(protype_id number, protype_name varchar(32));
alter table protype add constraint pk_protype primary key(protype_id);
insert into protype values(1, '硬件');
insert into protype values(2, '軟件');
insert into protype values(3, '服務(wù)');
commit;
/**產(chǎn)品表*/
create table product(pro_id number, protype_id number, pro_name varchar(32));
alter table product add constraint pk_product primary key(pro_id);
insert into product values(101, 1, '工控機(jī)');
insert into product values(102, 1, '條碼打印機(jī)');
insert into product values(103, 1, '顯示器');
insert into product values(201, 2, 'MES');
insert into product values(202, 2, 'LES');
insert into product values(203, 2, 'GoodMES');
insert into product values(204, 2, 'VEDI');
insert into product values(205, 2, 'Flexsite');
insert into product values(301, 3, '電話遠(yuǎn)程服務(wù)');
insert into product values(302, 3, '現(xiàn)場服務(wù)');
commit;
/**用戶表*/
create table customer(cus_id number, cust_name varchar2(50), gender char(1));
alter table customer add constraint pk_customer primary key(cus_id);
insert into customer values(1001, '王某某', '1');
insert into customer values(1002, '張某某', '0');
insert into customer values(1003, '李某某', '1');
insert into customer values(1004, '趙某某', '1');
commit;
/**銷售表*/
create table sale(sale_id number, pro_id number, cus_id number, unit_price number, quantity number);
alter table sale add constraint pk_sale primary key(sale_id);
insert into sale values(1, 101, 1001, 5000, 10);
insert into sale values(2, 202, 1003, 80000, 3);
insert into sale values(3, 204, 1003, 45000, 3);
insert into sale values(4, 102, 1004, 8000, 5);
insert into sale values(5, 201, 1001, 120000, 2);
insert into sale values(6, 205, 1001, 7000, 4);
insert into sale values(7, 301, 1002, 30000, 1);
insert into sale values(8, 302, 1002, 2000, 10);
insert into sale values(9, 101, 1004, 5000, 2);
insert into sale values(10, 103, 1004, 2000, 2);
insert into sale values(11, 201, 1002, 2000, 1);
commit;
2、在Schema Workbench中構(gòu)建多維數(shù)據(jù)的立方體模型
模式文件如下(Schema Workbench的使用可參考另一篇文章):
<Schema name="sales">
<Cube name="Cube_sales" visible="true" cache="true" enabled="true">
<Table name="SALE" schema="SALES">
</Table>
<Dimension type="StandardDimension" visible="true" foreignKey="CUS_ID" highCardinality="false" name="Dim_Cust" caption="客户维度">
<Hierarchy visible="true" hasAll="true" allMemberName="AllCustomer" allMemberCaption="所有客户" primaryKey="CUS_ID">
<Table name="CUSTOMER" schema="SALES">
</Table>
<Level name="Level_Gender" visible="true" column="GENDER" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="客户性别">
</Level>
<Level name="Level_Name" visible="true" column="CUST_NAME" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="客户姓名">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" visible="true" foreignKey="PRO_ID" highCardinality="false" name="Dim_Product" caption="产品维度">
<Hierarchy visible="true" hasAll="true" allMemberName="AllProduct" allMemberCaption="所有产品" primaryKey="PRO_ID" primaryKeyTable="PRODUCT">
<Join leftKey="PROTYPE_ID" rightKey="PROTYPE_ID">
<Table name="PRODUCT" schema="SALES">
</Table>
<Table name="PROTYPE" schema="SALES">
</Table>
</Join>
<Level name="Level_ProductName" visible="true" table="PRODUCT" column="PRO_ID" nameColumn="PRO_NAME" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never" caption="产品名称">
</Level>
<Level name="Level_ProductType" visible="true" table="PROTYPE" column="PROTYPE_ID" nameColumn="PROTYPE_NAME" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never" caption="产品类别">
</Level>
</Hierarchy>
</Dimension>
<Measure name="SaleQuantity" column="QUANTITY" datatype="Numeric" aggregator="sum" caption="销售数量" visible="true">
</Measure>
<Measure name="SaleAmount" datatype="Numeric" aggregator="sum" caption="销售总额" visible="true">
<MeasureExpression>
<SQL dialect="generic">
<![CDATA[(UNIT_PRICE*QUANTITY)]]>
</SQL>
</MeasureExpression>
</Measure>
<CalculatedMember name="AvgPrice" formatString="¥#,##0.00" caption="平均单价" formula="[Measures].SaleAmount/[Measures].SaleQuantity" dimension="Measures" visible="true">
</CalculatedMember>
</Cube>
</Schema>
3、Saiku中添加模式和數(shù)據(jù)源
進(jìn)入管理控制臺
http://localhost:8080
添加模式文件,注意模式名最好和Schema文件中的Schema name一致,上傳成功后應(yīng)提示Upload Successsful!
添加數(shù)據(jù)源
4、添加完成后注銷并重新登陸,如果配置和數(shù)據(jù)庫連接無誤,在多維數(shù)據(jù)列表里就可以看到添加的新模型
選取指標(biāo)和維度,可以看到數(shù)據(jù)分析結(jié)果
直方圖展示
曲線圖展示
熱點(diǎn)圖展示
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“多維數(shù)據(jù)分析引擎Saiku怎么安裝使用”這篇文章對大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。