我想为C++创建一个简单的Thrift服务器,并为客户端提供Python语言.我去了官方网站,但它没有任何好的教程或文档.我很难尝试.
对于一个全新的人,有没有什么好的Apache Thrift教程?
我不能,为了我的生活,成功运行"宝石安装节俭",在构建宝石的原生扩展时,事情就失败了; 这是输出:
(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) 我在服务器(serv1)上运行cassandra服务器.cassandra-cli可以在serv1上运行时连接到它.但是,当我尝试通过其他服务器(serv2)连接到它时,我得到以下异常:
org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
at org.apache.thrift.transport.TSocket.open(TSocket.java:183)
at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81)
at org.apache.cassandra.cli.CliMain.connect(CliMain.java:80)
at org.apache.cassandra.cli.CliMain.main(CliMain.java:256)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at org.apache.thrift.transport.TSocket.open(TSocket.java:178)
... 3 more
Exception connecting to jckstore/9160. Reason: Connection refused.
Run Code Online (Sandbox Code Playgroud)
我查看了cassandra.yaml,发现属性"listen_address"配置为"localhost",严禁使用0.0.0.0.我试图将localhost更改为serv2,serv1的ip地址,但没有任何效果.即使发表评论也没有帮助.
有没有办法可以让我的cassandra服务器在不使用0.0.0.0的情况下监听所有的ip
我最近偶然发现了2002年的会议论文(让Erlang与 Joe Armstrong 谈谈外界),我想知道这是否是一个被忽视的标准或是否有任何采用?
我应该专注于Apache Thrift进行跨平台通信吗?(我选择的任何解决方案至少涉及Erlang)
我们正在使用Apache Thrift在两个系统之间交换消息.在其中一条消息中,我们正在交换一个可能变得庞大的列表(c ++).能告诉我们使用Apache Thrift可以交换的最大邮件大小是多少?
我想用Scrooge编写一个Thrift服务.
Thrift几乎没有文档,Scrooge甚至更少.
如何在Ubuntu或OSX机器上安装Scrooge?
安装完成后,我创建了一个.thrift,如何使用Scrooge生成服务器代码和客户端代码?
我是节俭的新手.我需要我的数据对象转换为一个JSON string与Thrift JSON序列化.
我试过这种方式.
TSerializer serializer = new TSerializer(new TSimpleJSONProtocol.Factory());
String json = serializer.toString(object_name);
Run Code Online (Sandbox Code Playgroud)
在这里是一个错误,object_name应该在TBase.我该如何解决这个问题?
我安装了python 2.7并尝试使用happybase与hbase thrift服务器进行通信.
python2.7 test.py
Traceback (most recent call last):
File "test.py", line 5, in <module>
for key, data in table.rows([b'row01']):
File "/home/qa/happybase/happybase/table.py", line 162, in rows
self.name, rows, columns, {})
File "/usr/local/lib/python2.7/site-packages/thriftpy-0.3.8-py2.7-linux-x86_64.egg/thriftpy/thrift.py", line 160, in _req
return self._recv(_api)
File "/usr/local/lib/python2.7/site-packages/thriftpy-0.3.8-py2.7-linux-x86_64.egg/thriftpy/thrift.py", line 172, in _recv
fname, mtype, rseqid = self._iprot.read_message_begin()
File "thriftpy/protocol/cybin/cybin.pyx", line 439, in cybin.TCyBinaryProtocol.read_message_begin (thriftpy/protocol/cybin/cybin.c:6457)
cybin.ProtocolError: No protocol version header
Run Code Online (Sandbox Code Playgroud)
/usr/local/lib/python2.7/site-packages/thriftpy-0.3.8-py2.7-linux-x86_64.egg下没有cybin.c
克隆https://github.com/eleme/thriftpy.git
cybin.c也不存在.
关于如何克服错误的建议表示赞赏
我的 plugins.sbt 是
addSbtPlugin("com.twitter" % "scrooge-sbt-plugin" % "4.8.0")
Run Code Online (Sandbox Code Playgroud)
我的 build.sbt 是
val finagleVersion = "6.45.0"
lazy val myProject = Project("FinagleTest", file("."))
.settings(
name := "FinagleTest",
version := "1.0",
scalaVersion := "2.12.2",
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.9.2",
"com.twitter" %% "scrooge-core" % "4.18.0" exclude("com.twitter", "libthrift"),
"com.twitter" %% "finagle-thrift" % finagleVersion exclude("com.twitter", "libthrift"),
"com.twitter" %% "finagle-http" % finagleVersion,
"com.twitter" %% "finagle-core" % finagleVersion
),
scroogeThriftSourceFolder in Compile := {
val base = baseDirectory.value
base / "src/main/thrift"
}
)
Run Code Online (Sandbox Code Playgroud)
在src/main/thrift …
我正在尝试使用pyspark, 远程读取配置单元表。它指出无法连接到 Hive Metastore 客户端的错误。
我在 SO 和其他来源上阅读了多个答案,它们主要是配置,但没有一个可以解决为什么我无法远程连接的问题。我阅读了文档并观察到无需更改任何配置文件,我们就可以将 spark 与hive. 注意:我已经端口转发了一台hive正在运行的机器并将其提供给localhost:10000. 我什至使用相同的方法连接presto并且能够在hive.
代码是:
from pyspark import SparkContext, SparkConf
from pyspark.sql import SparkSession, HiveContext
SparkContext.setSystemProperty("hive.metastore.uris", "thrift://localhost:9083")
sparkSession = (SparkSession
.builder
.appName('example-pyspark-read-and-write-from-hive')
.enableHiveSupport()
.getOrCreate())
data = [('First', 1), ('Second', 2), ('Third', 3), ('Fourth', 4), ('Fifth', 5)]
df = sparkSession.createDataFrame(data)
df.write.saveAsTable('example')
Run Code Online (Sandbox Code Playgroud)
我希望输出是表被保存的确认,但相反,我正面临这个错误。
抽象错误是:
During handling of the above exception, another exception occurred:
Traceback (most recent call last): …Run Code Online (Sandbox Code Playgroud)