Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537
DS :Output Delivery Sysstem
其實(shí)就是把做好得報(bào)告用PDF,HTML,CSV等其他格式送出去得一個(gè)命令
在SAS BASE 的考試?yán)锍霈F(xiàn)得相當(dāng)頻繁
1.哪一個(gè)命令產(chǎn)生得文件EXCEL無法識(shí)別?
A. MSOFFICE2K
B. EXCELXP
C. CSVALL
D. WINXP
答:WINXP, CSVALL 雖然不是EXCEL格式,但是Excel 可以讀取CSV格式文件
2.這道題我是第3次做,驚出一身冷汗
ods csvall file='c:\test.cvs'; /*注意看這里,test.cvs,是不是后綴有問題?*/
proc print data=WORK.ONE;
var Name Score Grade;
by IdNumber;
run;
ods csvall close;
CSV文件可以由文本文件編輯器和EXCEl打開,這個(gè)后綴為CVS得文件,怎么操作?
答:這是個(gè)Tricky!ods csvall 規(guī)定了文件的格式,test.cvs就是這個(gè)名字
它還是一個(gè)CSV文件,第3遍才發(fā)現(xiàn),這個(gè)點(diǎn)還是把我騙過去了
3.讓你挑花眼
A. ods html open='sales.html';
ods html close;
B. ods file='sales.html' / html;
ods file close;
C. ods html file='sales.html';
ods html close;
D. ods file html='sales.html';
ods file close;
哪一個(gè)格式是對(duì)的?對(duì)的只有一個(gè),最樸素的那個(gè)
ODS html file=‘ ’;/* ODS html 要送html文件了, 文件file=‘ ’送到這里*/
ODS html close; /* ODS html 完成*/
我將在3次復(fù)習(xí)后,把知識(shí)點(diǎn)編織進(jìn)一個(gè)分析案例
只需要做一次典型的案例分析,就自然的把知識(shí)點(diǎn)融會(huì)貫通
不需要死記硬背了。而且,還能用于實(shí)際工作
關(guān)注轉(zhuǎn)發(fā),一起學(xué)SAS吧
言:
不是做數(shù)倉(cāng)的,但是也需要了解數(shù)倉(cāng)的知識(shí)。 其實(shí)分層好多因人而異,問了同事好多分層的區(qū)別也不是很清晰。 所以后續(xù)有機(jī)會(huì)還是跟數(shù)倉(cāng)的同事碰一下吧~
一. 各種名詞解釋
1.1 ODS是什么?
1.2 數(shù)據(jù)倉(cāng)庫層DW?
數(shù)據(jù)倉(cāng)庫層(DW),是數(shù)據(jù)倉(cāng)庫的主體.在這里,從 ODS 層中獲得的數(shù)據(jù)按照主題建立各種數(shù)據(jù)模型。這一層和維度建模會(huì)有比較深的聯(lián)系。 細(xì)分:
1.2.1 DWD明細(xì)層?
明細(xì)層(ODS, Operational Data Store,DWD: data warehouse detail)概念:是數(shù)據(jù)倉(cāng)庫的細(xì)節(jié)數(shù)據(jù)層,是對(duì)STAGE層數(shù)據(jù)進(jìn)行沉淀,減少了抽取的復(fù)雜性,同時(shí)ODS/DWD的信息模型組織主要遵循企業(yè)業(yè)務(wù)事務(wù)處理的形式,將各個(gè)專業(yè)數(shù)據(jù)進(jìn)行集中,明細(xì)層跟stage層的粒度一致,屬于分析的公共資源數(shù)據(jù)生成方式:部分?jǐn)?shù)據(jù)直接來自kafka,部分?jǐn)?shù)據(jù)為接口層數(shù)據(jù)與歷史數(shù)據(jù)合成。這個(gè)stage層不是很清晰
1.2.2 DWM 輕度匯總層(MID或DWB, data warehouse basis)
1.2.3 DWS 主題層(DM,data market或DWS, data warehouse service)
1.3 APP?
數(shù)據(jù)產(chǎn)品層(APP),這一層是提供為數(shù)據(jù)產(chǎn)品使用的結(jié)果數(shù)據(jù)。 主要是提供給數(shù)據(jù)產(chǎn)品和數(shù)據(jù)分析使用的數(shù)據(jù),一般會(huì)存放在 ES、Mysql 等系統(tǒng)中供線上系統(tǒng)使用,也可能會(huì)存在 Hive 或者 Druid 中供數(shù)據(jù)分析和數(shù)據(jù)挖掘使用。 如我們經(jīng)常說的報(bào)表數(shù)據(jù),或者說那種大寬表,一般就放在這里。
應(yīng)用層(App)
1.4 數(shù)據(jù)的來源
數(shù)據(jù)主要會(huì)有兩個(gè)大的來源: 業(yè)務(wù)庫,這里經(jīng)常會(huì)使用 Sqoop 來抽取 我們業(yè)務(wù)庫用的是databus來進(jìn)行接收,處理kafka就好了。 在實(shí)時(shí)方面,可以考慮用 Canal 監(jiān)聽 Mysql 的 Binlog,實(shí)時(shí)接入即可。(有機(jī)會(huì)補(bǔ)一下這個(gè)canal) 埋點(diǎn)日志,線上系統(tǒng)會(huì)打入各種日志,這些日志一般以文件的形式保存,我們可以選擇用 Flume 定時(shí)抽取,也可以用用 Spark Streaming 或者 Storm 來實(shí)時(shí)接入,當(dāng)然,Kafka 也會(huì)是一個(gè)關(guān)鍵的角色。 還有使用filebeat收集日志,打到kafka,然后處理日志 注意: 在這層,理應(yīng)不是簡(jiǎn)單的數(shù)據(jù)接入,而是要考慮一定的數(shù)據(jù)清洗,比如異常字段的處理、字段命名規(guī)范化、時(shí)間字段的統(tǒng)一等,一般這些很容易會(huì)被忽略,但是卻至關(guān)重要。特別是后期我們做各種特征自動(dòng)生成的時(shí)候,會(huì)十分有用。
1.5 ODS、DW → App層
這里面也主要分兩種類型:
1.6 維表層DIM?
維表層(Dimension) 最后補(bǔ)充一個(gè)維表層,維表層主要包含兩部分?jǐn)?shù)據(jù):高基數(shù)維度數(shù)據(jù):一般是用戶資料表、商品資料表類似的資料表。數(shù)據(jù)量可能是千萬級(jí)或者上億級(jí)別。低基數(shù)維度數(shù)據(jù):一般是配置表,比如枚舉值對(duì)應(yīng)的中文含義,或者日期維表。數(shù)據(jù)量可能是個(gè)位數(shù)或者幾千幾萬。
1.7 層級(jí)的簡(jiǎn)單分層圖
見下圖,對(duì)DWD層在進(jìn)行加工的話,就是DWM層(MID層)(我們的數(shù)倉(cāng)還是有很多dwm層的)
這里解釋一下DWS、DWD、DIM和TMP的作用。
二. 問題
2.1 DWS 與 DWD?
問答一: dws 和 dwd 的關(guān)系問:dws 和dwd 是并行而不是先后順序?答:并行的,dw 層問:那其實(shí)對(duì)于同一個(gè)數(shù)據(jù),這兩個(gè)過程是串行的?答:dws 會(huì)做匯總,dwd 和 ods 的粒度相同,這兩層之間也沒有依賴的關(guān)系問:對(duì)呀,那這樣 dws 里面的匯總沒有經(jīng)過數(shù)據(jù)質(zhì)量和完整度的處理,或者單獨(dú)做了這種質(zhì)量相關(guān)的處理,為什么不在 dwd 之上再做匯總呢?我的疑問其實(shí)就是,dws的輕度匯總數(shù)據(jù)結(jié)果,有沒有做數(shù)據(jù)質(zhì)量的處理?答:ods 直接到 dws 就好,沒必要過 dwd,我舉個(gè)例子,你的瀏覽商品行為,我做一層輕度匯總,就直接放在 dws 了。但是你的資料表,要從好多表湊成一份,我們從四五份個(gè)人資料表中湊出來了一份完整的資料表放在了 dwd 中。然后在 app 層,我們要出一張畫像表,包含用戶資料和用戶近一年的行為,我們就直接從dwd中拿資料, 然后再在 dws 的基礎(chǔ)上做一層統(tǒng)計(jì),就成一個(gè)app表了。當(dāng)然,這不是絕對(duì),dws 和 dwd 有沒有依賴關(guān)系主要看有沒有這種需求。
2.2 ODS與DWD區(qū)別?
問:還是不太明白 ods 和 dwd 層的區(qū)別,有了 ods 層后感覺 dwd 沒有什么用了。答:嗯,我是這樣理解的,站在一個(gè)理想的角度來講,如果 ods 層的數(shù)據(jù)就非常規(guī)整,基本能滿足我們絕大部分的需求,這當(dāng)然是好的,這時(shí)候 dwd 層其實(shí)也沒太大必要。 但是現(xiàn)實(shí)中接觸的情況是 ods 層的數(shù)據(jù)很難保證質(zhì)量,畢竟數(shù)據(jù)的來源多種多樣,推送方也會(huì)有自己的推送邏輯,在這種情況下,我們就需要通過額外的一層 dwd 來屏蔽一些底層的差異。問:我大概明白了,是不是說 dwd 主要是對(duì) ods 層做一些數(shù)據(jù)清洗和規(guī)范化的操作,dws 主要是對(duì) ods 層數(shù)據(jù)做一些輕度的匯總?答:對(duì)的,可以大致這樣理解。
2.3 app層干什么的?
問答三:app 層是干什么的?問:感覺數(shù)據(jù)集市層是不是沒地方放了,各個(gè)業(yè)務(wù)的數(shù)據(jù)集市表是應(yīng)該在 dwd 還是在 app?答:這個(gè)問題不太好回答,我感覺主要就是明確一下數(shù)據(jù)集市層是干什么的,如果你的數(shù)據(jù)集市層放的就是一些可以供業(yè)務(wù)方使用的寬表表,放在 app 層就行。如果你說的數(shù)據(jù)集市層是一個(gè)比較泛一點(diǎn)的概念,那么其實(shí) dws、dwd、app 這些合起來都算是數(shù)據(jù)集市的內(nèi)容。問:那存到 Redis、ES 中的數(shù)據(jù)算是 app層嗎?答:算是的,我個(gè)人的理解,app 層主要存放一些相對(duì)成熟的表,能供業(yè)務(wù)側(cè)使用的。這些表可以在 Hive 中,也可以是從 Hive 導(dǎo)入 Redis 或者 ES 這種查詢性能比較好的系統(tǒng)中。
三. 總結(jié)
另一個(gè)博主的圖蠻好:
主題(Subject)是在較高層次上將企業(yè)信息系統(tǒng)中的數(shù)據(jù)進(jìn)行綜合、歸類和分析利用的一個(gè)抽象概念,每一個(gè)主題基本對(duì)應(yīng)一個(gè)宏觀的分析領(lǐng)域。在邏輯意義上,它是對(duì)應(yīng)企業(yè)中某一宏觀分析領(lǐng)域所涉及的分析對(duì)象。例如“銷售分析”就是一個(gè)分析領(lǐng)域,因此這個(gè)數(shù)據(jù)倉(cāng)庫應(yīng)用的主題就是“銷售分析”。
裝 wget
yum install wget -y
創(chuàng)建lnmp文件 用于安裝lnmp
mkdir /lnmp
cd /lnmp
安裝lnmp
wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7 && ./install.sh lnmp
選擇安裝mysql 5.6
輸入數(shù)據(jù)庫密碼
開啟indb 一定要開啟 否則無法運(yùn)行seafile
安裝php 7.0
默認(rèn)就行
安裝完成
創(chuàng)建 seaflie文件夾
mkdir /opt/seafile/
cd /opt/seafile/
下載seafile安裝包
wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_7.0.5_x86-64.tar.gz
解壓seafile安裝包
tar -zxvf seafile-server_7.0.5_x86-64.tar.gz
mv seafile-server-7.0.5 seafile-server 改個(gè)名字
cd seafile-server 進(jìn)入安裝包文件夾
安裝必要依賴
yum install python python-setuptools MySQL-python python-urllib3 python-ldap -y
安裝seafle程序
./setup-seafile-mysql.sh
按下回車 提示輸入 名稱 隨便輸入
輸入服務(wù)器IP地址
輸入 剛剛創(chuàng)建的數(shù)據(jù)庫密碼 這里不會(huì)顯示 輸入完直接回車
等待安裝完成
安裝完成
開啟相關(guān)端口
開啟防火墻
systemctl start firewalld
開啟防火墻開機(jī)自啟
systemctl enable firewalld
開放端口
firewall-cmd --zone=public --add-port=8000/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --zone=public --add-port=8082/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8889/tcp --permanent
firewall-cmd --zone=public --add-port=10001/tcp --permanent
firewall-cmd --zone=public --add-port=12001/tcp --permanent
讓端口生效
firewall-cmd --reload
啟動(dòng)seafile
./seafile.sh start
./seahub.sh start
創(chuàng)建管理員郵箱和密碼
設(shè)置開機(jī)自啟seafile
新建seafile.service文件
vi /etc/systemd/system/seafile.service
輸入以下內(nèi)容(注意修改${seafile_dir}為你的seafile目錄)
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
# 如果沒有使用memcached則去掉memcached.service
After=network.target mariadb.service memcached.service
[Service]
Type=oneshot
ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start
# 如果seahub使用了nginx反代,請(qǐng)修改為 ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start-fastcgi
ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start
ExecStop=/opt/seafile/seafile-server-latest/seafile.sh restart
ExecStop=/opt/seafile/seafile-server-latest/seahub.sh restart
ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop
ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop
RemainAfterExit=yes
# User 和 Group 如果未建立seafile用戶和用戶組,則修改為root,否則無法啟動(dòng).
User=root
Group=root
[Install]
WantedBy=multi-user.target
運(yùn)行systemctl daemon-reload使配置生效
systemctl daemon-reload
命令
systemctl start seafile #啟動(dòng)seafile
systemctl stop seafile #停止seafile
systemctl enable seafile #設(shè)置seafile隨系統(tǒng)啟動(dòng)
systemctl is-enabled seafile #檢查seafile是否已經(jīng)設(shè)置為自啟動(dòng)
systemctl disable seafile #關(guān)閉seafile隨系統(tǒng)啟動(dòng)
設(shè)置上傳下載限制
vi /opt/seafile/conf/seafile.conf
# 上傳文件最大為20000M.
max_upload_size=20000
# 最大下載目錄限制為20000M.
max_download_dir_size=20000
添加一個(gè)端口網(wǎng)站 具體如下
lnmp vhost add
創(chuàng)建日志文件存放
touch /opt/seafile/logs/seahub.access.log
touch /opt/seafile/logs/seahub.error.log
定位到nginx下的配置文件
cd /usr/local/nginx/conf/vhost/
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $host;
}
map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}
server
{
listen 80;
server_name 10.25.2.220;
index index.html index.htm index.php default.html default.htm default.php;
server_name seafile.example.com;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
client_max_body_size 0;
access_log /opt/seafile/logs/seahub.access.log;
error_log /opt/seafile/logs/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
}
location /onlyofficeds/ {
proxy_pass http://10.10.1.23:8889/;
proxy_http_version 1.1;
client_max_body_size 100M; # Limit Document size to 100MB
proxy_read_timeout 3600s;
proxy_connect_timeout 3600s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host/onlyofficeds;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
設(shè)置默認(rèn)的 端口80
cd /usr/local/nginx/conf
vi nginx.conf
重啟nginx
service nginx restart
yum -y install wget
cd /etc/yum.repos.d/
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum repolist
yum -y install docker-ce
安裝完成后啟動(dòng) docker
systemctl start docker
systemctl enable docker
vi /etc/docker/daemon.json
添加
{
"registry-mirrors":["https://6w4lyiz2.mirror.aliyuncs.com"]
}
按下ESC 在輸入 :wq 保存退出
docker run -i -t -d --restart=always -p 8889:80 onlyoffice/documentserver
#--restart=always表示每次開機(jī),只要當(dāng)docker被設(shè)置為開機(jī)啟動(dòng),此onlyoffice就會(huì)自動(dòng)運(yùn)行 等待會(huì)有點(diǎn)久,如果等待6分鐘-10分鐘還沒下載完成就 ctrl+c結(jié)束 重新運(yùn)行
安裝完成
查看docker鏡像
docker ps
訪問:打開瀏覽器訪問http://x.x.x.x:8889/welcome x.x.x.x替換成自己的服務(wù)器IP
vi /opt/seafile/conf/seahub_settings.py
在此文件下末尾添加如下內(nèi)容(把10.25.7.251改為自己服務(wù)器ip地址):
# Enable Only Office
ENABLE_ONLYOFFICE=True
VERIFY_ONLYOFFICE_CERTIFICATE=False
ONLYOFFICE_APIJS_URL='http://10.25.2.220:8889/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION=('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION=('docx', 'pptx', 'xlsx','ppt','xls','doc')
設(shè)置郵箱系統(tǒng) 修改對(duì)于的郵件和密碼
vi /opt//opt/seafile/conf/seahub_settings.py
EMAIL_USE_SSL=True
EMAIL_HOST='smtp.exmail.qq.com'
EMAIL_HOST_USER='centosm@qq.com郵箱'
EMAIL_HOST_PASSWORD='hQsyPfCWVYi密碼'
EMAIL_PORT='465'
DEFAULT_FROM_EMAIL=EMAIL_HOST_USER
SERVER_EMAIL=EMAIL_HOST_USER
修改端口設(shè)置(不修改的話無法在線編輯)把這里的8000端口刪除
/opt/seafile/seafile-server/seafile.sh restart
/opt/seafile/seafile-server/seahub.sh restart
登入賬號(hào)密碼
點(diǎn)擊公共----點(diǎn)擊添加資料庫----點(diǎn)擊新建資料庫----新建一個(gè)文件夾 test
進(jìn)入test,上傳一個(gè) word excel ppt pdf 檢查是能夠在線編輯
*請(qǐng)認(rèn)真填寫需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。