标签: thrift

什么是Apache Thrift和Google Protocol Buffers用于?

我看到Thrift和Protocol Buffers提到了很多,但我真的不明白它们用于什么.根据我有限的理解,当你想要进行跨语言序列化时,它们基本上被使用,即当你有一种语言的某些数据结构要发送到另一种语言编写的另一个程序时.

它是否正确?它们用于其他任何东西吗?

(从我再次有限的理解,我认为Thrift和Protocol Buffers基本上是同一件事的两个不同版本 - 随意纠正我或详细说明.)

thrift protocol-buffers

13
推荐指数
1
解决办法
1913
查看次数

Thrift,JSON和REST之间的区别

有人可以告诉我JSON,Thrift和REST之间的区别吗?如何决定使用哪一个?哪一个是最快的?

rest json thrift

12
推荐指数
1
解决办法
1万
查看次数

Thrift Ruby gem

我不能,为了我的生活,成功运行"宝石安装节俭",在构建宝石的原生扩展时,事情就失败了; 这是输出:

(acib708) ~ -> gem install thrift
Building native extensions.  This could take a while...
ERROR:  Error installing thrift:
    ERROR: Failed to build gem native extension.

    /Users/acib708/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
extconf.rb:25:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:25:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
checking for strlcpy() in string.h... yes
creating Makefile

make "DESTDIR="
compiling binary_protocol_accelerated.c
compiling bytes.c
compiling compact_protocol.c
compiling memory_buffer.c
compiling protocol.c
compiling strlcpy.c
                                           ^
Run Code Online (Sandbox Code Playgroud)

(......)

In file included from strlcpy.c:20:
./strlcpy.h:28:15: error: …
Run Code Online (Sandbox Code Playgroud)

ruby thrift thrift-protocol osx-mavericks

12
推荐指数
3
解决办法
5545
查看次数

在Cassandra Docker中启用Thrift

我正在尝试启动运行cassandra的docker镜像.我需要使用thrift来与cassandra进行通信,但默认情况下它看起来是禁用的.检查cassandra日志显示:

INFO  21:10:35 Not starting RPC server as requested. 
  Use JMX (StorageService->startRPCServer()) or nodetool (enablethrift) to start it
Run Code Online (Sandbox Code Playgroud)

我的问题是:如何在启动这个cassandra容器时启用thrift?

我试图设置各种环境变量无济于事:

docker run --name cs1 -d -e "start_rpc=true" cassandra
docker run --name cs1 -d -e "CASSANDRA_START_RPC=true" cassandra
docker run --name cs1 -d -e "enablethrift=true" cassandra
Run Code Online (Sandbox Code Playgroud)

thrift cassandra docker

12
推荐指数
2
解决办法
1万
查看次数

Apache thrift:客户端超时问题

我有一些Apache Thrift(v.0.6.1)测试应用程序与perl-server和php-client.

我无法解释的行为:如果我们使用无效参数调用server-method,我们会在服务器输出中看到错误,但php-client会无限期地等待响应.

以下是服务器的来源:

sub new {
    my $classname = shift;
    my $self      = {};

    return bless($self,$classname);
}

sub DateToTimestamp
{
    my ($self, $date) = @_;
    my $result = CommonAPI::DateToTimestamp($date);
    return $result;
}

eval {
  my $handler       = new RPCHandler;
  my $processor     = new RPCPerformanceTest::RPCPerformanceTestProcessor($handler);
  my $serversocket  = new Thrift::ServerSocket(9091);
  my $forkingserver = new Thrift::ForkingServer($processor, $serversocket);
  print "Starting the server...\n";
  $forkingserver->serve();
  print "done.\n";
}; if ($@) {
  if ($@ =~ m/TException/ and exists $@->{message}) {
    my $message = $@->{message};
    my …
Run Code Online (Sandbox Code Playgroud)

php perl thrift

11
推荐指数
2
解决办法
8027
查看次数

Hbase客户端ConnectionLoss for/hbase错误

我疯了:

已安装的Hadoop/Hbase全部正在运行;

/opt/jdk1.6.0_24/bin/jps
23261 ThriftServer
22582 QuorumPeerMain
21969 NameNode
23500 Jps
23021 HRegionServer
22211 TaskTracker
22891 HMaster
22117 SecondaryNameNode
21779 DataNode
22370 Main
22704 JobTracker
Run Code Online (Sandbox Code Playgroud)

伪分布式环境.

hbase shell

正在工作并提出正确的结果运行'列表'和;

hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.1-cdh3u0, r, Fri Mar 25 16:10:51 PDT 2011

hbase(main):001:0> status
1 servers, 0 dead, 8.0000 average load
Run Code Online (Sandbox Code Playgroud)

当通过红宝石和节俭连接时,一切正常; 我们正在添加数据,它正在进入系统,我们可以查询/扫描它.一切似乎都很好.

但是,在与Java连接时:

groovy> import org.apache.hadoop.hbase.HBaseConfiguration 
groovy> import org.apache.hadoop.hbase.client.HBaseAdmin 
groovy> conf = HBaseConfiguration.create() 
groovy> conf.set("hbase.master","127.0.0.1:60000"); …
Run Code Online (Sandbox Code Playgroud)

ruby java hadoop hbase thrift

11
推荐指数
1
解决办法
4万
查看次数

在iOS中使用Thrift

在iOS中使用thrift有很好的文档吗?我无法入门并想办法如何将节俭应用到iOS.

thrift ios

11
推荐指数
1
解决办法
5084
查看次数

使用Thrift发送二进制数据的最佳方式

我有一个c ++结构,它存储如下字节:

struct RemoteData 
{
    /// some other fields here

    unsigned char* buf;
    int bufLen;     
};
Run Code Online (Sandbox Code Playgroud)

我需要通过thrift将这些数据发送到用c ++编写的远程服务.我找到了三种方法来将这个结构映射到thrift idl:

  1. 使用这样的容器类型:

    struct RemoteData 
    {
        1: list<BYTE> buf,
        ...
    }
    
    Run Code Online (Sandbox Code Playgroud)
  2. 使用binary类型:

    struct RemoteData 
    {
        1: binary buf,
        ...
    }
    
    Run Code Online (Sandbox Code Playgroud)
  3. string类型存储数据:

    struct RemoteData 
    {
        1: string buf,
        ...
    }
    
    Run Code Online (Sandbox Code Playgroud)

什么是最好的方法?

thrift

11
推荐指数
1
解决办法
1万
查看次数

HBase:Thrift vs Rest表现

我知道StackOverflow上有一些关于REST和Thrift for HBase的帖子,但我想稍微关注一下性能问题.

我一直在使用Node.js中的以下库连接到HBase实例:

找出为什么我不会从Thrift网关得到响应的麻烦之后,我终于让两个脚本都运行了,结果如下(每个输出相当于1000个操作完成):

??[mt@Marcs-MacBook-Pro]?[~/Sources/node-hbase]
???? node hbase.js 
hbase-write: 99ms
hbase-write: 3412ms
hbase-write: 3854ms
hbase-write: 3924ms
hbase-write: 3808ms
hbase-write: 9035ms
hbase-read: 216ms
hbase-read: 4676ms
hbase-read: 3908ms
hbase-read: 3498ms
hbase-read: 4139ms
hbase-read: 3781ms
completed
??[mt@Marcs-MacBook-Pro]?[~/Sources/node-hbase]
???? node thrift.js 
hbase-write: 4ms
hbase-write: 931ms
hbase-write: 1061ms
hbase-write: 988ms
hbase-write: 839ms
hbase-write: 807ms
hbase-read: 2ms
hbase-read: 435ms
hbase-read: 562ms
hbase-read: 414ms
hbase-read: 427ms
hbase-read: 423ms
completed
??[mt@Marcs-MacBook-Pro]?[~/Sources/node-hbase]
???? 
Run Code Online (Sandbox Code Playgroud)

使用的脚本可以在这里找到:https://github.com/stelcheck/node-hbase-vs-thrift

我的问题是,是否有人注意到HB和Thrift之间的差异(或者甚至只是一般的任何应用程序/语言)?

rest hadoop hbase thrift node.js

11
推荐指数
1
解决办法
1万
查看次数

使用Java中的Thrift进行异步请求

我正在寻找一个如何使用Thrift在Java中创建异步请求的示例.看看生成的代码这似乎是可能的,但我找不到一个如何的例子.

以下是生成代码的示例,该代码表明存在异步接口:

...
AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }
 ...
Run Code Online (Sandbox Code Playgroud)

关于如何使用它的任何指针?

java asynchronous thrift

10
推荐指数
1
解决办法
1万
查看次数