结合docker 快速的构建 Cassandra开发环境
2015-03-04 16:23
344 查看
尝试一门新的技术的时候。可以考虑使用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
2. Start the first node with the name
3. Start
the environment variable
If you don’t like or trust the one liner, here’s how to do it manually.
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:
Once your single node is setup, you can add more nodes using:
You can watch the cluster form by tailing the logs on
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.
原文出处: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.
1 | bash <(curl -sL http://bit.ly/docker-cassandra)[/code] |
1. Pull the
abh1nav/cassandra:latestimage.
2. Start the first node with the name
cass1
3. Start
cass2..5with
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:1 | docker pull abh1nav/cassandra:latest |
1 | docker run -d --name cass1 abh1nav/cassandra:latest |
1 | SEED_IP=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' cass1) |
1 | cqlsh $SEED_IP |
12 | ✈ megatron /opt/cassandra |
Cluster Setup
Once your single node is setup, you can add more nodes using:12 | for name in cass{2..5}; do echo "Starting node $name" docker run -d --name $name -e SEED=$SEED_IP abh1nav/cassandra:latest sleep 10 done |
cass1:
1 | docker logs -f cass1 |
1 | nodetool --host $SEED_IP status |
12 | ✈ megatron /opt/cassandra |
相关文章推荐
- 快速构建C++项目工具Scons,结合Editplus搭建开发环境
- Docker快速构建开发调试环境
- 快速构建C++项目工具Scons,结合Editplus搭建开发环境
- 使用docker快速构建rails开发环境
- 在Windows中构建基于Docker的一致性开发环境
- 如何利用docker快速构建MySQL主从复制环境
- (转)EOSIO开发(一)使用Docker构建本地环境
- 使用Facebook的create-react-app快速构建React开发环境
- 基于Docker构建PHP开发环境
- webstorm用create-react-app脚手架快速构建React开发环境
- 用 Docker 构建 PHP 开发环境
- 一个绿色版本的wmnp包(windows下快速构建php开发环境)
- PHP培训 使用Docker构建PHP的开发环境
- 为 Python Server Pages 和 Oracle 构建快速 Web 开发环境。
- 用Docker构建⼀个区块链工作和开发环境(上)
- 使用 Docker 构建开发、测试环境
- [转]利用Docker构建开发环境
- 利用Docker构建开发环境
- 【docker】使用docker快速搭建nginx+php开发环境
- 关于如何使用Docker构建PHP的开发环境