【问题标题】:apache thrift monitor a hdfs fileapache thrift 监控 hdfs 文件
【发布时间】:2017-10-08 08:58:34
【问题描述】:

我打算使用 Apache Thrift 来监控我本地更改的任何更改并将该数据推送到客户端(更改的数据)。

当我查看 thrift 文档时,我看到了多个传输层,但不明白我应该使用哪个传输层

http://thrift-tutorial.readthedocs.io/en/latest/thrift-stack.html

Tranport Layer
The transport layer is responsible for reading from and writing to the wire. Thrift supports the following:

TSocket - Uses blocking socket I/O for transport.
TFramedTransport - Sends data in frames, where each frame is preceded by a length. This transport is required when using a non-blocking server.
TFileTransport - This transport writes to a file. While this transport is not included with the Java implementation, it should be simple enough to implement.
TMemoryTransport - Uses memory for I/O. The Java implementation uses a simple ByteArrayOutputStream internally.
TZlibTransport - Performs compression using zlib. Used in conjunction with another transport. Not available in the Java implementation.

【问题讨论】:

    标签: thrift spark-thriftserver


    【解决方案1】:

    有两种传输方式:

    • 端点传输
    • 分层传输

    前者是您需要(其中之一)在网络中写入和读取数据的那些。例如,这可能是一个 TSocket。

    后者是附加使用的,在某些情况下甚至组合使用。例如,TFramedTransport 为数据添加了一个特殊的层,以提高内存分配和 I/O 的效率。 zlib 传输可用于压缩数据。

    一个例子可能是:

    +------------------------------------+
    |  Application code                  |
    +------------------------------------+
    |  TBinaryProtocol                   |
    +------------------------------------+
    |  TZLibTransport                    |
    +------------------------------------+
    |  TFramedTransport                  |
    +------------------------------------+
    |  TSocket transport                 |
    +------------------------------------+
    

    另一个根本没有分层传输:

    +------------------------------------+
    |  Application code                  |
    +------------------------------------+
    |  TBinaryProtocol                   |
    +------------------------------------+
    |  TSocket transport                 |
    +------------------------------------+
    

    PS:您链接的不是官方文档,这是一些第三方设置的,Apache Thrift项目对该网站的质量没有影响。

    强烈推荐the forthcoming Manning book from Randy Abernethy。他是一个节俭的提交者,这本书提供了宝贵的见解。不,我没有得到任何推荐。

    【讨论】:

    • 这本书会有很大的不同,非常感谢。
    • 你能给我介绍一下官方文档吗?i
    猜你喜欢
    • 1970-01-01
    • 2015-04-28
    • 2014-06-03
    • 1970-01-01
    • 1970-01-01
    • 2012-11-07
    • 1970-01-01
    • 2023-03-17
    • 2020-12-02
    相关资源
    最近更新 更多