gpt4 book ai didi

c++ - 任何人都可以在下面的 Thrift 程序中解决这个异常吗?

转载 作者:太空宇宙 更新时间:2023-11-04 12:07:16 26 4
gpt4 key购买 nike

我是 Thrift 的新手。我正在尝试在 ubuntu 10.10 上使用以下 Thrift 程序在 Hbase 中创建一个表(“示例”),谁能告诉我这是否正确。

#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <poll.h>

#include <iostream>

#include <boost/lexical_cast.hpp>
#include <protocol/TBinaryProtocol.h>
#include <transport/TSocket.h>
#include <transport/TTransportUtils.h>

#include "Hbase.h"

using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
using namespace apache::hadoop::hbase::thrift;
using namespace std;
int main()
{
boost::shared_ptr<TTransport> socket(new TSocket("localhost", 60010));
boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
HbaseClient client1(protocol);
try
{
transport->open();
string tableName("Sample");
vector<ColumnDescriptor> columns;
columns.push_back(ColumnDescriptor());
columns.back().name = "cf:";
columns.back().maxVersions = 10;
columns.push_back(ColumnDescriptor());
columns.back().name = "test";
try {
client1.createTable(tableName, columns);
} catch (const AlreadyExists &ae) {
std::cerr << "WARN: " << ae.message << std::endl;
}
}
catch (const TException &tx) {
std::cerr << "ERROR: " << tx.what() << std::endl;
}

return 0;
}

但是我在这个地方得到了以下异常 client1.createTable(tableName, columns);

ERROR: No more data to read.

请帮助解决这个问题。

最佳答案

知道了,需要通过 .<hbaseinstallationpath>/bin/hbase thrift -threadpool start 在 hbase 上启动 thrift 服务器

关于c++ - 任何人都可以在下面的 Thrift 程序中解决这个异常吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11519957/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com