我在这个问题上被困了好几天了。因此,任何帮助都将是非常感谢的。
我正试着制作一份卡桑德拉表格的副本(这样我就可以把它放到蜂窝亚稳态中,然后从Tableau访问)。蜂巢->表列部分工作,但卡桑德拉到蜂巢部分不工作。数据没有被复制到蜂巢亚稳态。
以下是我所采取的步骤:
我遵循了这个项目的自述指令:https://github.com/tuplejump/cash/tree/master/cassandra-handler
我生成了hive -cassandra-.jar,复制了它,并复制了cassandra-all.jar,cassandra-thrift-*.jar到hive lib文件夹。
然后,我开始蜂巢,并尝试了以下几点:
hive> add jar /usr/lib/hive/apache-hive-1.1.0/lib/hive-cassandra-1.2.6.jar;
Added [/usr/lib/hive/apache-hive-1.1.0/lib/hive-cassandra-1.2.6.jar] to class path
Added resources: [/usr/lib/hive/apache-hive-1.1.0/lib/hive-cassandra-1.2.6.jar]
hive> list jars;
/usr/lib/hive/apache-hive-1.1.0/lib/hive-cassandra-1.2.6.jar
hive> create temporary function tmp as 'org.apache.hadoop.hive.cassandra.cql3.CqlStorageHandler'
> ;
FAILED: Class org.apache.hadoop.hive.cassandra.cql3.CqlStorageHandler not found我不知道为什么蜂巢看不到CqlStorageHandler ..。
谢谢!
发布于 2015-06-08 17:36:42
您可以考虑的另一种方法是编写一个简单的java程序,将数据写入文件,然后将其加载到单元中。
package com.company.cassandra;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Cluster.Builder;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.ResultSetFuture;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
public class CassandraExport {
public static Session session;
public static void connect(String username, String password, String host, int port, String keyspace) {
Builder builder = Cluster.builder().addContactPoint(host);
builder.withPort(port);
if (username != null && password != null) {
builder.withCredentials(username, password);
}
Cluster cluster = builder.build();
session = cluster.connect(keyspace);
}
public static void main(String[] args) {
//Prod
connect("user", "password", "server", 9042, "keyspace");
ResultSetFuture future = session.executeAsync("SELECT * FROM table;");
ResultSet results = future.getUninterruptibly();
for (Row row : results) {
//Print the columns in the following order
String out = row.getString("col1") + "\t" +
String.valueOf(row.getInt("col2")) + "\t" +
String.valueOf(row.getLong("col3")) + "\t" +
String.valueOf(row.getLong("col4"));
System.out.println(out);
}
session.close();
session.getCluster().close();
}
}将输出写入文件,然后加载到单元中。
hive -e "use schema; load data local inpath '/tmp/cassandra-table' overwrite into table mytable;"https://stackoverflow.com/questions/29435848
复制相似问题