Cassandra Database(6)Multinode Cluster
On MAC system, we can do like this.
>sudo ifconfig lo0 alias 127.0.0.2 up
>sudo ifconfig lo0 alias 127.0.0.3 up
Then we have the IP 127.0.0.1, 127.0.0.2, 127.0.0.3
If I change the configuration file cassandra.yaml and want to start 3 nodes on my local machine. I got errors.
Error Message:
Port already in use: 7199
Solution:
Right now, I do not know the solution. Just go on and try CCM
>git clone https://github.com/pcmanus/ccm.git
That is cool, my local machine python version is 2.7.5.
sparkworker1:ccm carl$ python --version Python 2.7.5
>sudo easy_install pyYaml
>sudo ./setup.py install
>ccm help
>sudo ln -s /Users/carl/tool/ccm /opt/ccm
Create the Instance and Nodes
Tell ccm which version are we plan to use
>ccm create Test -v 2.0.4
Create a cluster named Test with version 2.0.4
Then create 3 nodes
>ccm populate -n 3
Start all the nodes
>ccm start
Then we have 3 nodes. We can connect as follow:
>cqlsh 127.0.0.3 9160
>ccm node1 ring Datacenter: datacenter1 ========== Address Rack Status State Load Owns Token 3074457345618258602 127.0.0.1 rack1 Up Normal 68.41 KB 66.67% -9223372036854775808 127.0.0.2 rack1 Up Normal 35.92 KB 66.67% -3074457345618258603 127.0.0.3 rack1 Up Normal 52.14 KB 66.67% 3074457345618258602
This is the method to add one more node
>ccm add node4 -i 127.0.0.4 -j 7400 -b
That is cool, we can use java library to connect to the cluster
val hosts = "127.0.0.1,127.0.0.2,127.0.0.3"
val nativePort = 9042 //9042, 9160
val keyspaceName = "books"
val columnFamilyName = "books"
val replicationStrategy = "SimpleStrategy"
val replicationFactor = 2
But from the document, ccm is only support local machine right now. So looking forward to see the future version.
>nodetool -host 127.0.0.1 -p 7100 status Datacenter: datacenter1 ======================= Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Owns (effective) Host ID Token Rack UN 127.0.0.1 40.74 KB 66.7% 03e83bcf-d409-4ea8-ac0c-3be00451cc1c -9223372036854775808 rack1 UN 127.0.0.2 51.02 KB 66.7% 133165df-a23a-4768-a339-62e453bb862d -3074457345618258603 rack1 UN 127.0.0.3 67.24 KB 66.7% b1f7c514-a0b6-4266-8d1b-e89f4d13f43e 3074457345618258602 rack1
References:
http://wiki.apache.org/cassandra/GettingStarted
- 浏览: 2542612 次
- 性别:
- 来自: 成都
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
相关推荐
在本文中,我们将深入探讨如何将Spring Boot框架与Cassandra数据库集成,并利用Java Persistence API (JPA) 进行数据操作。Spring Boot以其简洁的配置和开箱即用的特性,已经成为Java开发中的首选框架之一。而...
Cassandra is a distributed database that stands out thanks to its robust feature set and intuitive interface, while providing high availability and scalability of a distributed data store. This book ...
集群由 CCM(Cassandra Cluster Manager)管理。 创建杂波和数据模型 这里是我用来使用 ccm 创建集群的命令: ccm create cluster_test_1 -v 2.0.12 ccm populate -n 3 ccm start 创建集群后,打开 cql shell: ...
对于Cassandra集群,可能需要使用一个第三方提供商,如`hashicorp/consul`或者`cassandra/cluster`,来管理和配置Cassandra实例。 3. **变量和模块化**:为了实现复用和灵活性,Terraform支持定义变量和模块。在...
The book is aimed at intermediate developers with an understanding of core database concepts and want to become a master implementing Cassandra for their application. Table of Contents Chapter 1. ...
6. **负载均衡**:驱动包能够自动检测和处理Cassandra集群中的节点变化,如节点加入或离开,动态调整连接,实现负载均衡。 7. **容错机制**:如果某个节点故障,驱动程序会自动重定向请求到其他健康的节点,确保...
Beginning Apache Cassandra Development takes you through the Apache Cassandra NoSQL database and how to build applications that leverage its capabilities. As Java, PHP, Python, and JavaScript are the ...
Discover how Cassandra's distributed design lets you add or remove nodes from the cluster as your application requires, Get examples for writing clients in Java, Python, and C#, Extend Cassandra by ...
Apache Cassandra is the most commonly used NoSQL database written in Java and is renowned in the industry as the only NoSQL solution that can accommodate the complex requirements of today’s modern ...
2. 创建Cluster和Session:初始化Cassandra连接需要创建一个Cluster对象,表示一组Cassandra节点。然后,基于Cluster创建Session,用于执行实际的数据库操作。 ```java Cluster cluster = HFactory.getCluster(...
Build, manage, and configure high-performing, reliable NoSQL database for your applications with Cassandra Key Features Write programs more efficiently using Cassandra's features with the help of ...
2. **遵循JDBC规范**:Cassandra JDBC Driver严格遵循Java Database Connectivity (JDBC) API规范,使得熟悉JDBC的开发者能够轻松地将Cassandra集成到他们的Java应用中,利用已有的JDBC知识进行数据存取操作。...
在Java编程环境中,Cassandra数据库是一个高性能、分布式、NoSQL型的数据存储系统。它由Apache Software Foundation维护,设计用于处理大规模数据,具有高可用性和可扩展性。本篇将深入探讨如何使用Java来操作...
使用`Cluster.builder()`创建一个集群对象,并设置Cassandra节点的地址,然后调用`build()`方法建立连接。例如: ```java Cluster cluster = Cluster.builder() .addContactPoints("127.0.0.1") .withPort(9042...
6. 静态列的使用,这在Cassandra中是一种特殊的列,可以像预定义的联结那样工作。文档可能还包括了如何定义和使用静态列、静态列与数据交互的方式、静态插入操作,以及静态列在何时使用为宜。 7. 超越键值查找,...
6. **脚本和工作流**:DevCenter支持创建和运行CQL脚本,可以用于自动化数据库维护任务,如批量导入/导出数据、数据清理等。此外,用户还可以组织这些脚本为工作流,实现更复杂的操作流程。 7. **集群管理和连接**...
2. **遵循 JDBC 规范**:该驱动程序按照 JDBC(Java Database Connectivity)规范设计,提供了一个标准化的接口,使得开发人员能够在不深入了解 Cassandra 本身的底层机制的情况下,使用熟悉的 JDBC 代码来操作 ...