cassandra

你不是谷歌,不要学习它的一切

僤鯓⒐⒋嵵緔 提交于 2021-01-31 14:57:03
软件工程师对于最荒渺的事情非常热衷。我们倾向于认为自己是超理性的,但是当我们面临一种技术选择的时候,我们最终会陷入一种疯狂状态——从一个人的Hacker News评论跳到另一个人的博客文章,直到变得麻木,我们无助地漂浮朝着最明亮的光线倾斜,并且俯卧在它的前面,而忽略了我们最初寻找的东西。 这不是理性的人做出决定的方式,而是软件工程师决定使用MapReduce的方式。 正如Joe Hellerstein在他的本科数据库课程[1]上所说的(在54分钟): 问题是世界上有5家公司从事如此大的工作。对于其他所有人……你正在为实际上不需要的容错能力执行所有这些I/O。人们在2000年代有点Google的狂热:“我们将像Google一样做所有事情,因为我们也运行着世界上最大的互联网数据服务” [横摆倾斜,等待笑声] 你们的数据中心大楼有几层?Google在俄克拉荷马州梅斯县的数据中心是4层。 拥有比所需更多的容错能力可能听起来不错,但考虑到成本:不仅会做更多的I/O,而且可能会从一个成熟的系统(如事务,索引和查询优化器)过渡到某种相对不成熟的系统上。真是倒退了一大步[2]。有多少Hadoop用户自觉地进行了这些折衷?有多少用户明智地进行了这些折衷? 目前,MapReduce/Hadoop仅仅是一个简单的目标(soft target),即使开发人员已经意识到目标不是很合适。但是

高并发、高性能 Web 架构

人走茶凉 提交于 2021-01-30 10:49:55
典型 Web App 架构 以下是一个典型的高负载 web 应用示例: 上图展示了一个典型的,三层架构的高性能 Web 应用。这种成熟的架构多年以来已被广泛部署于包括 Google、Yahoo、Facebook、Twitter、Wikipedia 在内的诸多大型 Web 应用中。   反向代理服务 位于三层构架中最外层的反向代理服务器负责接受用户的接入请求,在实际应用中,代理服务器通常至少还要完成以下列表中的一部分任务: 连接管理 :分别维护客户端和应用服务器的连接池,管理并关闭已超时的长连接。   攻击检测和安全隔离 :由于反向代理服务无需完成任何动态页面生成任务,所有与业务逻辑相关的请求都转发至后端应用服务器处理。因此反向代理服务几乎不会被应用程序设计或后端数据漏洞所影响。反向代理的安全性和可靠性通常仅取决于产品本身。在应用服务的前端部署反向代理服务器可以有效地在后端应用和远程用户间建立起一套可靠的安全隔离和攻击检测机制。 如果需要的话,还可以通过在外网、反向代理、后端应用和数据库等边界位置添加额外的硬件防火墙等网络隔离设备来实现更高的安全性保证。   负载均衡 :通常使用轮转(Round Robin)或最少连接数优先等策略完成基于客户请求的负载均衡;也可以使用 SSI 等技术将一个客户请求拆分成若干并行计算部分分别提交到多个应用服务器。   分布式的 cache 加速

Cassandra order by second clustering key

放肆的年华 提交于 2021-01-29 09:35:58
问题 I have a table in cassandra and I want to order by the second clustering column and leave the first clustering column. It is the table definition: CREATE TABLE table1 ( key int, value1 text, value2 text, value3 text, comments text, PRIMARY KEY (key, value1, value2, value3) )WITH CLUSTERING ORDER BY (value2 DESC); I know that the above script is wrong and I should change it below: CREATE TABLE table1 ( key int, value1 text, value2 text, value3 text, comments text, PRIMARY KEY (key, value1,

从B+树到LSM树,及LSM树在HBase中的应用

最后都变了- 提交于 2021-01-29 07:34:24
前言 在有代表性的关系型数据库如MySQL、SQL Server、Oracle中,数据存储与索引的基本结构就是我们耳熟能详的B树和B+树。而在一些主流的NoSQL数据库如HBase、Cassandra、LevelDB、RocksDB中,则是使用日志结构合并树(Log-structured Merge Tree,LSM Tree)来组织数据。本文先由B+树来引出对LSM树的介绍,然后说明HBase中是如何运用LSM树的。 回顾B+树 为什么在RDBMS中我们需要B+树(或者广义地说,索引)?一句话:减少寻道时间。在存储系统中广泛使用的HDD是磁性介质+机械旋转的,这就使得其顺序访问较快而随机访问较慢。使用B+树组织数据可以较好地利用HDD的这种特点,其本质是多路平衡查找树。下图是一棵高度为3的4路B+树示例。 与普通B树相比,B+树的非叶子节点只有索引,所有数据都位于叶子节点,并且叶子节点上的数据会形成有序链表。B+树的主要优点如下: 结构比较扁平,高度低(一般不超过4层),随机寻道次数少; 数据存储密度大,且都位于叶子节点,查询稳定,遍历方便; 叶子节点形成有序链表,范围查询转化为顺序读,效率高。相对而言B树必须通过中序遍历才能支持范围查询。 当然,B+树也不是十全十美的,它的主要缺点有两个: 如果写入的数据比较离散,那么寻找写入位置时,子节点有很大可能性不会在内存中

Jupyter Cassandra Save Problem - java.lang.NoClassDefFoundError: com/twitter/jsr166e/LongAdder

风格不统一 提交于 2021-01-29 06:40:23
问题 I am using Jupyter notebook and want to save csv file to cassandra db. There is no problem while getting data and showing it, But when I try to save this csv data to cassandra db it throws below exception. : org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1.0 failed 1 times, most recent failure: Lost task 0.0 in stage 1.0 (TID 1, localhost, executor driver): java.lang.NoClassDefFoundError: com/twitter/jsr166e/LongAdder I dowloaded maven package manually both

date column which is a text type in Cassandra.so I need a UDF to convert that text to timestamp so I can query on that column

三世轮回 提交于 2021-01-29 05:29:19
问题 I have writeen code like belo but getting error as below:- InvalidRequest: Error from server: code=2200 [Invalid query] message="Java source compilation failed: Line 1: java.util.String cannot be resolved to a type Line 1: Syntax error on token "Date", @ expected Line 4: SimpleDateFormat cannot be resolved to a type CREATE FUNCTION saumya.text2dt ( input text ) RETURNS NULL ON NULL INPUT RETURNS timestamp LANGUAGE java AS $$ java.text.ParseException java.text.SimpleDateFormat java.util.Date

Limiting columns per record in CQL

左心房为你撑大大i 提交于 2021-01-29 03:28:30
问题 I've a problem which has been bothering me from quite while now. I'm scaling it down for simplification. I've a column family in Cassandra defined as: CREATE TABLE "Test" ( key text, column1 text, value text, PRIMARY KEY (key, column1) ) If I run a query in CQL as: select * from "Test" where key in ('12345','34567'); It gives me something like: key | column1 | value -----------------------+--- 12345 | 764 | 764 12345 | 836 | 836 12345 | 123723 | 123723 12345 | 155863 | 155863 key | column1 |

How do you create a table in Cassandra using phantom for Scala?

允我心安 提交于 2021-01-28 18:11:12
问题 I am trying to run the example on https://github.com/websudos/phantom/blob/develop/phantom-example/src/main/scala/com/websudos/phantom/example/basics/SimpleRecipes.scala ,So I created a Recipe and tried to insert it using insertNewRecord(myRecipe) and got the following exception: ....InvalidQueryException: unconfigured columnfamily my_custom_table . I checked using cqlsh and the keyspace was created but the table was not. So my question is, how do I create the table using phantom? This is

Kubernetes: Cassandra(stateful set) deployment on GCP

本小妞迷上赌 提交于 2021-01-28 12:20:38
问题 Has anyone tried deploying Cassandra (POC) on GCP using kubernetes (not GKE). If so can you please share info on how to get it working? 回答1: I have implemented cassandra on kubernetes. Please find my deployment and service yaml files: apiVersion: v1 kind: Service metadata: labels: app: cassandra name: cassandra spec: clusterIP: None ports: - port: 9042 selector: app: cassandra --- apiVersion: apps/v1beta2 kind: StatefulSet metadata: name: cassandra labels: app: cassandra spec: serviceName:

com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table user"

这一生的挚爱 提交于 2021-01-28 09:58:52
问题 I am new to Cassandra and this has been giving me issues. I downloaded apache-Cassandra 3.11 and I am using spring boot 1.5.4.RELEASE. I did some research and found a source where it says it may be because Spring data is using a different Cassandra driver core version? But the latest uses cql 3 correct? I also made a java class configuration file. The issue may be here. import org.springframework.cassandra.config.CassandraCqlClusterFactoryBean; import org.springframework.cassandra.config