cassandra

How to use Asynchronous/Batch writes feature with Datastax Java driver

强颜欢笑 提交于 2020-01-10 14:30:34
问题 I am planning to use Datastax Java driver for writing to Cassandra.. I was mainly interested in Batch Writes and Asycnhronous features of Datastax java driver but I am not able to get any tutorials which can explain me how to incorporate these features in my below code which uses Datastax Java driver.. /** * Performs an upsert of the specified attributes for the specified id. */ public void upsertAttributes(final String userId, final Map<String, String> attributes, final String columnFamily)

How can I restore Cassandra snapshots?

杀马特。学长 韩版系。学妹 提交于 2020-01-10 07:58:10
问题 I'm building a backup and restore process for a Cassandra database so that it's ready when I need it, and so that I understand the details in order to build something that will work for production. I'm following Datastax's instructions here: http://www.datastax.com/documentation/cassandra/2.0/cassandra/operations/ops_backup_restore_c.html. As a start, I'm seeding the database on a dev box then attempting to make the backup/restore work. Here's the backup script: #!/bin/bash cd /opt/apache

Is there a clear equivalent of 'show keyspaces' in cqlsh 2?

自作多情 提交于 2020-01-10 06:52:33
问题 What cqlsh command can I use to quickly see the keyspaces in a cluster? cqlsh does not provide show keyspaces and describe cluster isn't as concise as I want. I'm working using the following specifications: cqlsh 2.2.0, Cassandra 1.1.10, CQL spec 2.0.0, Thrift protocol 19.33.0 回答1: Very simple. Just enter this command in your cqlsh shell and enjoy select * from system.schema_keyspaces; In C*3.x, we can simply use describe keyspaces 回答2: Just try this: describe keyspaces However you may need

how to use lag/lead function in spark streaming application?

☆樱花仙子☆ 提交于 2020-01-10 05:26:18
问题 I am using spark-sql 2.4.x version , datastax-spark-cassandra-connector for Cassandra-3.x version. Along with kafka. I have a scenario for some finance data coming from kafka topic. like companyId, year , quarter , sales ,prev_sales data. val kafkaDf = sc.parallelize(Seq((15,2016, 4, 100.5,"")).toDF("companyId", "year","quarter", "sales","prev_sales") I need to prev_sales with previous year same quarter data from cassandra table which is something like below val cassandraTabledf = sc

How to fix the “Found Netty's native epoll transport in the classpath, but epoll is not available. Using NIO instead” warning?

自闭症网瘾萝莉.ら 提交于 2020-01-09 05:27:25
问题 I am using Cassandra and, during startup, Netty prints a warning with a stack trace: Found Netty's native epoll transport in the classpath, but epoll is not available. Using NIO instead." The application works normally, but is there a way to fix the warning? Here is the full stack trace: 16:29:46 WARN com.datastax.driver.core.NettyUtil - Found Netty's native epoll transport in the classpath, but epoll is not available. Using NIO instead. java.lang.UnsatisfiedLinkError: no netty-transport

Is there any way to Load Spark SQL resultset (data frames ) back to cassandra?

点点圈 提交于 2020-01-07 07:50:51
问题 I have queried Cassandra using spark in Scala. Below is the result: Is there any way to write this result back to Cassandra tables ? 回答1: df.write .format("org.apache.spark.sql.cassandra") .options(Map( "table" -> "t_payu_df", "keyspace" -> "ks_payu")) .save() This will work. You can also specify SaveMode (overwrite,append,ErrorIfExists). Example with SaveMode: df.write .format("org.apache.spark.sql.cassandra") .mode(SaveMode.Overwrite) .options(Map( "table" -> "t_payu_df", "keyspace" -> "ks

Handling Exceptions for Deferred Tasks in Cassandra

久未见 提交于 2020-01-07 06:40:57
问题 I've looked numerous posts on task exception handling and I'm not clear how to resolve this issue. My application crashes anytime there is an exception in one of my tasks. I am unable to catch the exception and my application is left in an inoperable state. UPDATE: This only seems to happen when calling the ExecuteAsync method in the DataStax Cassandra C# driver. This leads me to believe it's an issue in the driver itself. When I create my own task and throw an exception it works fine. Most

dse-driver connection refused

◇◆丶佛笑我妖孽 提交于 2020-01-07 06:14:15
问题 I am trying to connect to my Datastax enterprise Cassandra install on a server. When I try to connect I receive an error: Cassandra connection error { [Error: All host(s) tried for query failed. First host tried, XX.XX.XX.XX:9042: Error: connect ECONNREFUSED XX.XX.XX.XX:9042. See innerErrors.] innerErrors: { 'XX.XX.XX.XX:9042': { Error: connect ECONNREFUSED XX.XX.XX.XX:9042 at Object.exports._errnoException (util.js:896:11) at exports._exceptionWithHostPort (util.js:919:20) at TCPConnectWrap

How to add cassandra table column dynamically?

社会主义新天地 提交于 2020-01-07 05:50:07
问题 I'm trying to add a new columns to cassandra table dynamically. I'm using below version - cqlsh 5.0.1 I'm using python to interact with Cassandra. I have one python list which I wish to add as a column names to Cassandra table. Python List - ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T'] Currently, I'm iterating a list and then adding each column one by one to cassandra table like below - from cassandra.cluster import Cluster cluster = Cluster(['localhost'])

How is sorting done in cassandra? [closed]

拜拜、爱过 提交于 2020-01-07 05:29:27
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I am a newbie in Cassandra. Does Cassandra follow any specified sorting algorithm like bubble sort , binary sort , etc.? If not, How does it sort in order by command? 回答1: It doesn't, or at least it shouldn't. In Cassandra you build your data model around your use cases. So if you