V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  wdg8106  ›  全部回复第 3 页 / 共 5 页
回复总数  81
1  2  3  4  5  
@Jackliu91
又碰到了个 thrift 连接 hive 的 问题请教下啊,

先执行 hive --service hiveserver2 & 命令启动 hiveserver ,

然后执行脚本连接 hive 进行操作:
# test.py
#!/usr/bin/env python

import sys
from hive_service import ThriftHive
#!/usr/bin/env python

import sys
from hive_service import ThriftHive
from hive_service.ttypes import HiveServerException
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol

def hiveExe(sql):
try:
transport = TSocket.TSocket('127.0.0.1',10000)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = ThriftHive.Client(protocol)
transport.open()
client.execute(sql)

print "The return value is:"
print client.fetchAll()
print "................."
transport.close()
except Thrift.TException,tx:
print "%s" % (tx.message)

if __name__ == '__main__':
print "hello"
hiveExe("show tables")

就是执行一行简单的 查看所有表的语句,但是程序卡在 client.execute(sql) 这行就不动了。

请问这个问题怎么解决呢,,,

用 netstat 命令查看 10000 端口 hiveServer 是启动成功的。
$ netstat -nl |grep 10000
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN

在 CLI 里面也是可以正常进行 hive 查询操作的
@Jackliu91
太感谢了,就是这个问题, O(∩_∩)O 哈哈~
@Jackliu91
create table if not exists hive.stu(id int,name string) row format delimited fields terminated by '\t';
hive 读取文件写入数据库写入的是空值是怎么回事呢。。
文件 stu.txt :
1 xiaopi
2 xiaoxue
3 qingqing

执行语句:
load data local inpath '/usr/local/hadoop/examples/stu.txt' overwrite into table stu;

查询表 stu :
hive> select id ,name from stu;
OK
NULL NULL
NULL NULL
NULL NULL
Time taken: 0.087 seconds, Fetched: 3 row(s)

hadoop 是伪分布式的,请问这个怎么解决呢,
@AntonChen @Jackliu91 @wander2008
@Jackliu91 嗯,就是当了解一下集群的配置
@AntonChen
@Jackliu91
说起伪分布式,我其实只是想熟悉下 hive 的操作,在伪分布式上可以操作 hive 么。。集群跑不起来的话,执行一个 hive 操作通常就卡主了。。
@Jackliu91 伪分布式安装已经成功了,想试一下集群,但是只有一台机器。。
非常感谢,今天刚开始答,我再仔细看看日志
@jasonhan214 我试试
@mimzy 多谢多谢,问题解决
2016-04-18 20:50:16 +08:00
回复了 wdg8106 创建的主题 Python app 使用微信登陆问题请教
@mikii 什么尴尬啊....
@ghostheaven 不能让每个用户都这么干吧。。。
@williamnet 我们采用的差不多,关键是有时候返回的是状态是发送成功,但是用户那边却没有收到,这个很烦...
@UnisandK
@Light3
@odirus
@egen
多谢大家,我先试试阿里的看看,
http://serverfault.com/questions/348815/how-to-change-libcurl-ssl-backend-from-gnutls-to-openssl-on-ubuntu-server
最后附上更换库的方式,希望能帮到遇到和我一样问题的人
@kungfuchicken 太感谢了, 打印的是
PycURL/7.19.3 libcurl/7.35.0 GnuTLS/2.12.23 zlib/1.2.8 libidn/1.28 librtmp/2.3',
我更新一下 pycurl 的版本就好了
@hei1000 哈哈 这样一目了然啊
@asdwfwqd
@bombless
多谢各位,环境搭好了,果然是放个 webview 就可以用了,现在还在看怎么实现微信授权登陆
@bombless
@junbaor
下个 android sdk 都下了好久了,而且 log 里面好多 Downloading Interrupted:URLL not found 的错误,这个怎么解决呢...
@xuboying
@momowei
只要做个简单的,就像楼上说的用个控件把 url 塞进去就行了
1  2  3  4  5  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2884 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 21ms · UTC 09:30 · PVG 17:30 · LAX 02:30 · JFK 05:30
Developed with CodeLauncher
♥ Do have faith in what you're doing.