结合docker 快速的构建 Cassandra开发环境
尝试一门新的技术的时候。可以考虑使用docker 解决环境的依赖,简单方便快捷。原文出处:http://blog.abhinav.ca/blog/2014/09/15/cassandra-cluster-docker-one-command/补充一点,下面需要的cql等命令需要自己手动的安装下载地址:http://mirrors.cnnic.cn/apache/cassandra/2.1.
尝试一门新的技术的时候。可以考虑使用docker 解决环境的依赖,简单方便快捷。
原文出处:http://blog.abhinav.ca/blog/2014/09/15/cassandra-cluster-docker-one-command/
补充一点,下面需要的cql等命令需要自己手动的安装下载地址:http://mirrors.cnnic.cn/apache/cassandra/2.1.3/apache-cassandra-2.1.3-bin.tar.gz
summary:
下面介绍的很简单。
方法1:完全的自动化,博主已经写了一个shell,可以快速的部署
方法2:分成了两部分,部分一 部署一个单节点,单节点作为seed,然后依次添加其余的四个节点,其余四个节点的SEED IP 是当地一个单节点的IP。
剩下的就是怎么去操作 Cassandra,我博客里有另一篇的转载,虽然年代久远,但是还是很简单的。
文章中部分的命令替换
/opt/apache-cassandra-2.1.3/bin/nodetool --host $SEED_IP status
/opt/apache-cassandra-2.1.3/bin/cqlsh $SEED_IP
[2014-09-16] Update: The command now brings up a 5-node Cassandra cluster in addition to DataStax OpsCenter 5.0.0 and wires it all up together. See the GitHub repo for details. Each node runs in its own container with the Cassandra process + DataStax Agent while OpsCenter runs in its own container separate from the cluster.
[Original Post]
Run this command to bring up a 5-node Cassandra (2.1.0) cluster locally using Docker.
This will:
1. Pull the abh1nav/cassandra:latest
image.
2. Start the first node with the name cass1
3. Start cass2..5
with the environment variable SEED=<ip of cass1>
Manual mode
If you don’t like or trust the one liner, here’s how to do it manually.
Single Node Setup
To start the first node, pull the latest version of image:
Start the first instance:
Grab its IP using:
Connect to it using cqlsh:
The expected output is:
Cluster Setup
Once your single node is setup, you can add more nodes using:
You can watch the cluster form by tailing the logs on cass1
:
Once the cluster is up, you can check its status using:
The expected output is:
Check out the Docker registry page for the image and the GitHub repo to grab the source.
更多推荐
所有评论(0)