1 实施Cassandra集群,并验证集群功能正常,抓图实验过程

2 为什么说对于布隆过滤器有"确定某个元素是否在某个集合中的代价和总的元素数目无关"?误判率和元素数目有关吗?为什么?

First, make sure that the nodes in the cluster all have the same name and the same keyspace definitions so that the new node can accept data.

Edit the config file on the second node to indicate that the first one will act as the seed.

Then, set autobootstrap to true.

1.

IP

是否为seeds

192.168.1.106

yes

192.168.1.111

no

[root@datanode01 conf]# mkdir /var/log/cassandra

[root@datanode01 conf]# chown student /var/log/cassandra/

[root@datanode01 bin]# mkdir /var/lib/cassandra

[root@datanode01 bin]# chown student /var/lib/cassandra

192.168.1.106

- seeds: "192.168.1.106"

listen_address: 192.168.1.106

Rpc_address:192.168.106

192.168.1.111

- seeds: "192.168.1.106"

listen_address: 192.168.1.111

Rpc_address:192.168.111

查看集群的状态:

[student@datanode01 bin]$ ./nodetool status

xss = -ea -javaagent:./../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms503M -Xmx503M -Xmn100M -XX:+HeapDumpOnOutOfMemoryError -Xss256k

Datacenter: datacenter1

=======================

Status=Up/Down

|/ State=Normal/Leaving/Joining/Moving

-- Address Load Tokens Owns (effective) Host ID Rack

UN 192.168.1.111 55.32 KB 256 100.0% fddbf3a2-a221-4e88-bd2b-19e3db13894b rack1

UN 192.168.1.106 40.82 KB 256 100.0% ff335767-f93c-48d4-92d9-ae11aa3b0f40 rack1

[student@datanode01 bin]$

2.

确定某个元素是否在某个集合中的时间代价为

各个哈希函数运算时间和各个哈希结果在二进制向量中的比较时间,由于哈希函数是确定的,哈希结果在向量中的比较时间也是确定的,所以确定某个元素是否在某个集合中的时间代价也是确定的,不会随着元素数目多少而变化,也就是无关的。

确定某个元素是否在某个集合中的空间代价主要为各次哈希结果的空间代价和二进制向量的空间代价,由于哈希的次数和算法是确定的,从而其各次哈希结果也是确 定的,二进制向量的长度也是确定的,不会随着元素数目多少而变化,所以确定某个元素是否在某个集合中的空间代价也与总的元素数目无关。

误判率和元素数目有关,因为元素数目越大,哈希结果在二进制向量中存放"1"值的数量就越大,导致发生哈希碰撞的概率就越大,即误判率就越高

以下是对cql的初体验:

 [student@datanode01 bin]$ ./cqlsh
Connected to Test Cluster at localhost:.
[cqlsh 4.1. | Cassandra 2.0. | CQL spec 3.1. | Thrift protocol 19.38.]
Use HELP for help.
cqlsh> create keysapce yao with replication = {'class':'SimpleStrategy','replication_factor':};
Bad Request: line : no viable alternative at input 'keysapce'
cqlsh> create keyspace yao with replication = {'class':'SimpleStrategy','replication_factor':};
cqlsh> use yao
... ;
cqlsh:yao> create table users(userid int primary key,fname text,lname text);
cqlsh:yao> drop table users;
cqlsh:yao> create table users(user_id int primary key,fname text,lname text);
cqlsh:yao> INSERT INTO users (user_id, fname, lname)
... VALUES (, 'john', 'smith');
INSERT INTO users (user_id, fname, lname)
VALUES (, 'john', 'doe');
INSERT INTO users (user_id, fname, lname)
VALUES (, 'john', 'smith');cqlsh:yao> INSERT INTO users (user_id, fname, lname)
... VALUES (, 'john', 'doe');
cqlsh:yao> INSERT INTO users (user_id, fname, lname)
... VALUES (, 'john', 'smith');
cqlsh:yao> select * from users; user_id | fname | lname
---------+-------+-------
| john | smith
| john | doe
| john | smith ( rows) cqlsh:yao> create index on users(lname);
cqlsh:yao> select * from users where lname='smith'; user_id | fname | lname
---------+-------+-------
| john | smith
| john | smith ( rows)

Cassandra 分布式集群的更多相关文章

  1. YCSB测试HBase远程完全分布式集群

    写在前面 本文只讲一个很简单的问题,YCSB对HBase集群的测试.虽然网上有很多介绍YCSB测试HBase的文章,但都是针对本地HBase伪分布式集群的.大家都知道,稍微正式一些的压测都会要求测试客 ...

  2. Hadoop伪分布式集群环境搭建

    本教程讲述在单机环境下搭建Hadoop伪分布式集群环境,帮助初学者方便学习Hadoop相关知识. 首先安装Hadoop之前需要准备安装环境. 安装Centos6.5(64位).(操作系统再次不做过多描 ...

  3. ElasticSearch 5学习(7)——分布式集群学习分享2

    前面主要学习了ElasticSearch分布式集群的存储过程中集群.节点和分片的知识(ElasticSearch 5学习(6)--分布式集群学习分享1),下面主要分享应对故障的一些实践. 应对故障 前 ...

  4. ElasticSearch 5学习(6)——分布式集群学习分享1

    在使用中我们把文档存入ElasticSearch,但是如果能够了解ElasticSearch内部是如何存储的,将会对我们学习ElasticSearch有很清晰的认识.本文中的所使用的ElasticSe ...

  5. Redis分布式集群几点说道

    原文地址:http://www.cnblogs.com/verrion/p/redis_structure_type_selection.html  Redis分布式集群几点说道 Redis数据量日益 ...

  6. Hadoop学习笔记—13.分布式集群中节点的动态添加与下架

    开篇:在本笔记系列的第一篇中,我们介绍了如何搭建伪分布与分布模式的Hadoop集群.现在,我们来了解一下在一个Hadoop分布式集群中,如何动态(不关机且正在运行的情况下)地添加一个Hadoop节点与 ...

  7. 安装ClouderaManager以及使用ClouderaManager安装分布式集群的若干细节

    目录 前言 整体介绍 分步安装介绍 总结 一.前言        周末干了近四十个小时中间只休息了五个小时终于成功安装了ClouderaManager以及分布式集群,其中各种辛酸无以言表,唯有泪两行. ...

  8. Zookeeper分布式集群搭建

    实验条件:3台安装linux的机子,配置好Java环境. 步骤1:下载并分别解包到每台机子的/home/iHge2k目录下,附上下载地址:http://mirrors.cnnic.cn/apache/ ...

  9. 分布式集群搭建(hadoop2.6.0+CentOS6.5)

    摘要:之前安装过hadoop1.2.1集群,发现比较老了,后来安装cloudera(hadoop2.6.0),发现集成度比较高,想知道原生的hadoop什么样子,于是着手搭建一个伪分布式集群(三台), ...

随机推荐

  1. JPA(5)使用二级缓存

    jpa的缓存分为一级缓存和二级缓存,一级缓存值得是会话级别的,而二级缓存是跨会话级别的. 使用二级缓存,使用到了Ehcache,首先第一步需要在配置文件中配置使用了二级缓存 <shared-ca ...

  2. [PE结构分析] 5.IMAGE_OPTIONAL_HEADER

    结构体源代码如下: typedef struct _IMAGE_OPTIONAL_HEADER { // // Standard fields. // +18h WORD Magic; // 标志字, ...

  3. 那些教程没有的php1-基础知识补漏

    php.net 字符串 heredoc结构 类似双引号,其中的变量会被解析.严格遵循下边的格式,结束标识符这行除了可能有一个分号(;)外,绝对不能包含其它字符. <?php $str = < ...

  4. Linux Shell系列教程之(十七) Shell文件包含

    本文是Linux Shell系列教程的第(十七)篇,更多Linux Shell教程请看:Linux Shell系列教程 通过文件包含,可以引用其他文件的内容,也可以将复杂内容分开,使程序结构更加清晰. ...

  5. Fresco

    1.简介 Fresco是Facebook最新推出的一款用于Android应用中展示图片的强大图片库,可以从网络.本地存储和本地资源中加载图片.相对于ImageLoader,拥有更快的图片下载速度以及可 ...

  6. Follow me to learn what is Unit of Work pattern

    Introduction A Unit of Work is a combination of several actions that will be grouped into a transact ...

  7. android 打包错误

    打包时报如下错误: Export aborted because fatal lint errors were found. These are listed in the Lint View. Ei ...

  8. Python基础(1)--Python编程习惯与特点

    1.代码风格 在Python中,每行程序以换行符代表结束,如果一行程序太长的话,可以用“\”符号扩展到下一行.在python中以三引号(""")括起来的字符串,列表,元组 ...

  9. C++非类型模板参数

    对于函数模板与类模板,模板参数并不局限于类型,普通值也可以作为模板参数.在基于类型参数的模板中,你定义了一些具体的细节来加以确定代码,直到代码被调用时这些细节才被真正的确定.但是在这里,我们面对的是这 ...

  10. JSON取值前判断

    public static void main(String[] args)throws Exception{ String jsonStr1="{\"access_token\& ...