流数据管理关键技术研究和原型体验

背景:流数据管理是dw里面一个比较新的技术趋势,在很多实时性和新鲜性要求很高

的场合发挥重要作用。比如去年比较热门的股票证券行业,当前流数据和历史数据的作用

结合才能发挥最大的参考作用。一般情况下,dw面临的是历史数据,在实时性高的情况

下,会要求看到最新的数据,在互联网行业,人们都对朋友,商业伙伴的信息保持高度的

关注,引发出来的进一步的商业潜在需求会是什么?是对当前最新数据实时分析和汇总,

从技术层面来看就是对最新的数据还能做join,sum,group等分析操作。

        不得不承认,在dw技术方面,国外起步比国内要早很多年,对流数据的基础技术的研

究,斯坦福大学对data warehouse的技术研究有一个专门的小组,data warehouse at 

standford,起步非常早,包含抽取复杂异构数据源,数据仓库的高效优化,物理和逻辑

设计,查询过程原理,海量数据恢复,数据挖掘等等多个方面。其中有一个project就是今

天我们要研究的主题,流数据管理,stanford stream data manager。

      研究这项技术的驱动力来源,网络监控,电磁通信数据管理,点击流监控,传感器数

据管理,这方面的数据如果用户存在需要长时间持续查询而非传统的一次性查询的需求,

则需要类似的流数据查询技术。也就是会持续关注multiple, continuous, rapid,

time-varying data streams的时候会使用到类似的技术。

        stanford早在十年前对这项技术进行了研究,并开发出原型系统,其中涉及到并行数

据流,内存有限的范围内对无限流数据做join等难点的理论研究对当前的技术仍然有非常

重要的指导意义。本文不在理论方面做过多探讨,这篇文章的重点是从整体上看一下流数

据管理的一个概貌,给大家一个感性认识。

 

下面和大家一步步演示如何搭建一个流数据原型环境。下面的步骤假设大家对linux,虚拟机,java,ant等技术有一定的基础。

步骤1:准备一台rhel 5.2,5.3 ,4.5或者4.7的虚拟机,选择安装开发需要的大部分工具比如gcc等,如果不清楚,可以选择全部安装。

步骤2:准备好流数据的关键软件server端和client端软件,以及java,ant 等软件。

列表如下:

server端:http://infolab.stanford.edu/stream/code/stream-0.6.0.tar.gz

client端:http://infolab.stanford.edu/stream/code/stream-vis-0.3.0.tar.gz

ant 1.7   http://labs.xiaonei.com/apache-mirror/ant/binaries/apache-ant-1.7.1-bin.tar.gz

步骤3:开始配置。

 

安装好java和ant,然后配置如下:

Building the Server

[root@test stream-0.6.0]# pwd
/root/stream/stream-0.6.0

  • ./configure --prefix=/root/stream
  • make
  • make install

    test the server:

    [root@test test]# pwd
    /root/stream/stream-0.6.0/test

    root@test test]# ./test.sh
    Test 1 ok
    Test 2 ok
    Test 3 ok
    Test 4 ok
    Test 5 ok
    Test 6 ok
    Test 7 ok
    Test 8 ok
    Test 9 ok
    Test 10 ok
    [root@test test]# ./cleanup.sh
    [root@test test]#

    Building the Client

    [root@test stream-vis-0.3.0]# pwd
    /root/stream/stream-vis-0.3.0

  • chmod +x geninit.sh
  • ./geninit.sh
  • ant

     

    [root@test stream-vis-0.3.0]# cd lib
    [root@test lib]# ls
    STREAMvis.jar
    [root@test lib]# ls -ltr
    total 196
    -rw-r–r–  1 root root 190680 Mar 29 09:49 STREAMvis.jar

     

    步骤4:如何使用流数据系统。

    vi ~/.bash_profile

    export ANT_HOME=/root/stream/apache-ant-1.7.1

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/stream/lib/

    PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$ANT_HOME/bin:/root/stream/bin/

    export PATH
    unset USERNAME

    [root@test lib]# source ~/.bash_profile

    下载 http://infolab.stanford.edu/stream/code/config ,放到

    [root@test stream]# pwd
    /root/stream
    [root@test stream]# more config
    #
    # Config file for the STREAM server
    #
    # None of the config parameters are strictly necessary.  If the value for some
    # parameter is not specified, the system assumes reasonable default values
    #

    #
    # The size of the memory in bytes that is used during the execution of the system.
    #
    # 32 MB
    #

    MEMORY_SIZE = 33554432

    #
    # Queues have fixed sizes.  A smaller value of QUEUE_SIZE means that the operators
    # execute is a more tightly coupled manner.  This should be an integer value > 1.
    # The queue size is specified in number of pages.  A page is the atomic unit of memory
    # It is set to 4096 bytes.
    #
    #

    QUEUE_SIZE = 1

    #
    # Shared queue size in pages.  A shared queue is a queue which has one writer operator
    # and many read operators.  It is useful to set this value higher than QUEUE_SIZE.
    #

    SHARED_QUEUE_SIZE = 30

    #
    # This should be a fraction (between 0 & 1).  It is similar to the threshold value
    # used in a disk-based linear hash table.  A smaller value leads to cheaper index updates
    # but lookups could be costlier and vice-versa.

    INDEX_THRESHOLD = 0.85

    #
    # Long long int value that roughly translates to the duration for which the system is run.
    # The special values ‘0′ indicates that the server should run forever.  For net_server
    # program, the value of this parameter should always be 0
    #

    RUN_TIME = 0

    #
    # The CPU clock speed (MHz) of the machine on which the server is run.  It is very important
    # to set this number to the correct value, since it is used to calibrate various internal
    # timers used in the system.
    #

    CPU_SPEED = 2000

    [root@test stream]#

  • mkdir logs
  • net_server -c config -l logs/log -p 9000

    [root@test bin]# ./net_server
    Usage: ./net_server -l [logFilePref] -c [configFile] -p [portNo]
    [root@test bin]# pwd
    /root/stream/bin

    [root@test stream-vis-0.3.0]# pwd
    /root/stream/stream-vis-0.3.0

  • chmod +x vis.sh
  • ./vis.sh

     

    image

     

    image

     

    image

     

    简单sum

    image

    image

    image

    简单join:

    image

    image

    image

    可以在运行过程中监控cpu的运行情况,并且可以随时暂停其中任意一个数据流。

    image

    点击执行计划的图中的任意节点,可以看到具体的信息,非常直观。

    image

    image

     

    这个查询sql的含义是从2个流数据R,S中找出名字相同,但是R的value比S的value大的记录。

    大家可以想象一下这个技术在实时监控中的强大作用。

    感兴趣的同学可以参考

    http://infolab.stanford.edu/stream/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值