express-cassandra | Cassandra ORM/ODM/OGM for Node.js with optional support
kandi X-RAY | express-cassandra Summary
kandi X-RAY | express-cassandra Summary
Express-Cassandra is a Cassandra ORM/ODM/OGM for NodeJS with Elassandra & JanusGraph Support. No more hassling with raw cql queries from your nodejs web frameworks. Express-Cassandra automatically loads your models and provides you with object oriented mapping to your cassandra tables like a standard ORM/ODM. Built in support for Elassandra and JanusGraph allows you to automatically manage synced elasticsearch and janusgraph indexes stored in cassandra. Express-cassandra enables your nodejs app to manage a highly available distributed data store capable of handling large dataset with powerful query features powered by cassandra, elasticsearch and janusgraph combined. Express-cassandra empowers you to manage and query this truely distributed datastore with search, analytics and graph computing functionality from nodejs like you are just dealing with javascript objects and methods. Models are written as javascript modules and they automatically create the underlying db tables, indexes, materialized views, graphs etc. Afterwards you can save, update, delete and query your data using supported model methods. It's decoupled nature allows you to use it with many popular node frameworks without much hassle. If you are using elassandra, then saved data in cassandra automatically syncs with elasticsearch indexes defined in your schema. You can then do any query elasticsearch indexes support. If you are using janusgraph, then you can easily manage your graphs and graph indexes. Creating vertices and edges become simple function calls. You can then do any graph query the tinkerpop3 gremlin query language supports.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of express-cassandra
express-cassandra Key Features
express-cassandra Examples and Code Snippets
Community Discussions
Trending Discussions on express-cassandra
QUESTION
My goal is to do a sum of the messages_sent and emails_sent per each DISTINCT provider_id value for a given time range (fromDate < stats_date_id < toDate), but without specifying a provider_id. In other words, I need to know about any and all Providers within the specified time range and to sum their messages_sent and emails_sent.
I have a Cassandra table using an express-cassandra schema (in Node.js) as follows:
...ANSWER
Answered 2019-Sep-19 at 18:26So while not having used Express-Cassandra, I can tell you that running a range query on your partition key is a hard "no." The reason for this, is that Cassandra can't determine a single node for that query, so it has to poll every node. As that's essentially a full scan of your table across multiple nodes, it throws that error to prevent you from running a bad query.
However, you can run a range query on a clustering key, provided that you are filtering on all of the keys prior to it. In your case, if I'm reading this right, your PRIMARY KEY looks like:
PRIMARY KEY (stats_date_id, created_at)
That primary key definition is going to be problematic for two reasons:
stats_date_id
is a TimeUUID. This is great for data distribution. But it sucks for query flexibility. In fact, you will need to provide that exact TimeUUID value to return data for a specific partition. As a TimeUUID has millisecond precision, you'll need to know the exact time to query down to the millisecond. Maybe you have the ability to do that, but usually that doesn't make for a good partition key.Any rows underneath that partition (
created_at
) will have to share that exact time, which usually leads to a lot of 1:1 cardinality ratios for partition:clustering keys.
My advice on fixing this, is to partition on a date column that has a slightly lower level of cardinality. Think about how many provider messages are usually saved within a certain timeframe. Also pick something that won't store too many provider messages together, as you don't want unbound partition growth (Cassandra has a hard limit of 2 billion cells per partition).
Maybe something like: PRIMARY KEY (week,created_at)
So then your CQL queries could look something like:
QUESTION
So I have the following setup, I have a 8 servers on a local network, each of them running cassandra. 2 of the servers are seed nodes and rest are just regular nodes. If I run nodetool status, everything shows up correctly and all nodes are UN.
I have a express.js application that is running express-cassandra. It has plenty of tables and materialized views (70 in total), I have to restart the express server multiple times, for the cassandra keyspace to be populated with the tables, otherwise it will just stop populating at some point. After the tables are created, I can access all standard tables just fine, but when I try to access any of the materialized view tables, I keep getting error about unconfigured table - InvalidRequest: Error from server: code=2200 [Invalid query] message="unconfigured table ...
Also, if I run my application, all queries to the materialized views fails.
It seems like the database creation process keeps corrupting (due to the reason I have to restart express server to make sure that all tables are created). If I just start the express.js server and leave it running, it will stop creating tables at around 20 tables (I left it running for around 2 hours without any table created). If I restart it, it will again create few tables, and then again stop. And so on, until I have created all tables.
Also, when I try to do repair on that keyspace (which is created by express-cassandra), I keep getting failure to connect to one of the nodes, although nodetool status shows it's up.
...ANSWER
Answered 2019-Apr-25 at 09:10Posting an answer here, just so if anyone else receives similar issue is aware what is causing that.
I had an issue with materialized view name - it was too long. Unfortunately express-cassandra
does not provide any information about materialized view length in meaningful way.
Did not try the exact length but it was greater than 70 characters.
QUESTION
So I'm trying to setup multi-node cassandra cluster.
I've setup 3 cassandra nodes on 3 different servers. In all of the three cassandra.yaml files, I've defined the same one seed node. After clearing the data and restarting the services one by one, I can see them showing up and the nodetool status shows UN for all entries. Now I use express-cassandra for connecting to the cassandra, and that works just fine, but it only works for the first few queries and afterwards, it just crashes with the following error -
Error during find query on DB -> ResponseError: Server failure during read query at consistency ONE (1 responses were required but only 0 replicas responded, 2 failed)
It does not matter on which read query it fails, but it's up for like 10 seconds and then it dies. Sometimes it dies on queries which were successful on previous run. Also, I'm just wondering, why it says that 2 failed, if there are 3 nodes (one seed node)?
I noticed, that express-cassandra notified that the Replication factor has been changed and to run the nodetool repair, but there I keep getting the following error message -
Validation failed in /xxx.xxx.xxx.xxx (progress: 0%)
[2018-07-02 08:10:33,447] Some repair failed
Where xxx.xxx.xxx.xxx
is one of the three node IP addresses. I tried to run the nodetool repair on each of the nodes, but I keep getting identical errors on each of the servers.
These are my express-cassandra setup properties (xxx.xxx.xxx.xxx is my seed ip address):
...ANSWER
Answered 2019-Apr-25 at 09:06Providing an answer here, just in case anyone else struggles.
The issue was related to the NetworkTopologyStrategy
. I switched to SimpleStrategy
, and it started to work.
I had just one DC.
Not sure, what exactly was causing the issue, but if anyone is aware, feel free to add it in comment, and I'll update the answer.
QUESTION
Thank you for taking the time to look at my issue. My team and I just started dabbling with NodeJS and this is the first time we have run into a problem that we cannot find a solution for ourselves thus far.
Simply put, we have a Controller that needs to query Cassandra with a UUID primary key.
Controller:
...ANSWER
Answered 2017-Mar-21 at 09:02Uuid type should be queried without quotes (").
I'm not a NodeJS specialist, but maybe you should use cassandra type uuid?
There's Datastax article on uuid:
http://docs.datastax.com/en/developer/nodejs-driver/latest/features/datatypes/uuids/
QUESTION
I am using express-Cassandra ORM and DB operation with Cassandra.
Env: version: 2.1.1 nodejs 8.9.1 cassandra : 3.9 Cent OS: 6.0
Facing this issue, when running nodejs while initializing models in Cassandra and I need to restart nodejs multiple time to initialize all the modules.
Getting timeout error: cause: { apollo.model.tablecreation.dbindexcreate: Error while creating index on DB Table -> NoHostAvailableError: All host(s) tried for query failed. First host tried, 127.0.0.1:9042: OperationTimedOutError: The host 127.0.0.1:9042 did not reply before timeout 12000 ms. See innerErrors
So after restart mulitpel time I am able to complete cassandra initialisation.
and How can I resolve this or how can I find where are more logs and what is this inner error?
Thanks, James
...ANSWER
Answered 2018-Mar-10 at 10:05You may need to use socketOptions.readTimeout
in your clientOptions like the following:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install express-cassandra
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page