- 浏览: 2551229 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
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
Apache Cassandra 2019 Version in Docker
I think the conf/cassandra.yaml should be from the sample
Important Makefile will be as follow:
IMAGE=sillycat/public
TAG=ubuntu-cassandra
NAME=ubuntu-cassandra
prepare:
wget http://apache.osuosl.org/cassandra/3.11.4/apache-cassandra-3.11.4-bin.tar.gz -P install/
mkdir logs
mkdir data
docker-context:
build: docker-context
# docker build --no-cache -t $(IMAGE):$(TAG) .
docker build -t $(IMAGE):$(TAG) .
run:
docker run -d -p 127.0.0.1:7000-7001:7000-7001 -p 127.0.0.1:7199:7199 -p 127.0.0.1:9042:9042 -p 127.0.0.1:9160:9160 -v $(shell pwd)/data:/tool/cassandra/data -v $(shell pwd)/logs:/tool/cassandra/logs --name $(NAME) $(IMAGE):$(TAG)
debug:
docker run -ti -p 7000-7001:7000-7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 -v $(shell pwd)/data:/tool/cassandra/data -v $(shell pwd)/logs:/tool/cassandra/logs --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
docker stop ${NAME}
docker rm ${NAME}
logs:
docker logs ${NAME}
publish:
docker push ${IMAGE}:${TAG}
fetch:
docker pull ${IMAGE}:${TAG}
The start.sh will detect the IP for running machine.
#!/bin/sh -ex
#prepare config
INTERNAL_IP="$(hostname --ip-address)"
sed -ri 's/(listen_address:).*/\1 "'"$INTERNAL_IP"'"/' "/tool/cassandra/conf/cassandra.yaml"
#start the cassandra
/tool/cassandra/bin/cassandra -Dcassandra.config=file:///tool/cassandra/conf/cassandra.yaml -R -f
tail -f /tool/cassandra/logs/debug.log
Here is the Dockerfile shows all the steps
#Set up Cassandra in Docker
#Prepare the OS
FROM ubuntu:16.04
MAINTAINER Rachel Kang <yiyikangrachel@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt-get -qq update
RUN apt-get -qqy dist-upgrade
#Prepare the denpendencies
RUN apt-get install -qy wget unzip vim
RUN apt-get install -qy iputils-ping
#Install SUN JAVA
RUN apt-get update && \
apt-get install -y --no-install-recommends locales && \
locale-gen en_US.UTF-8 && \
apt-get dist-upgrade -y && \
apt-get --purge remove openjdk* && \
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
apt-get update && \
apt-get install -y --no-install-recommends oracle-java8-installer oracle-java8-set-default && \
apt-get clean all
#Install the application
WORKDIR /tool/
ADD install/apache-cassandra-3.11.4-bin.tar.gz /tool/
RUN ln -s /tool/apache-cassandra-3.11.4 /tool/cassandra
RUN mkdir /tool/cassandra/logs
RUN mkdir /tool/cassandra/data
ADD conf/cassandra.yaml /tool/cassandra/conf/
#Start the Application
# 7000: intra-node communication
# 7001: TLS intra-node communication
# 7199: JMX
# 9042: CQL
# 9160: thrift service
EXPOSE 7000 7001 7199 9042 9160
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app
CMD [ "./start.sh” ]
Put the command tool in class path
sudo ln -s /Users/hluo/tool/apache-cassandra-3.11.4 /opt/cassandra-3.11.4
Check Version
> cqlsh --version
cqlsh 5.0.1
Connect to localhost
> cqlsh localhost 9042
Verify with an easy sample
Create Database
cqlsh> create keyspace mykeyspace with replication = { 'class': 'SimpleStrategy', 'replication_factor':1};
cqlsh> use mykeyspace;
Create Table
> cqlsh:mykeyspace> create table users ( user_id int primary key, firstname text, lastname text );
Insert Some Data
cqlsh:mykeyspace> insert into users(user_id, firstname, lastname) values (1,'carl','luo');
cqlsh:mykeyspace> insert into users(user_id, firstname, lastname) values (2,'ray','luo');
cqlsh:mykeyspace> insert into users(user_id, firstname, lastname) values (3,'kiko','kang');
Search
select * from users;
user_id | firstname | lastname
---------+-----------+----------
1 | carl | luo
2 | ray | luo
3 | kiko | kang
Create Index
cqlsh:mykeyspace> create index on users (lastname);
Search on Index
select * from users where lastname = 'luo';
user_id | firstname | lastname
---------+-----------+----------
1 | carl | luo
2 | ray | luo
Search with primary key
select * from users where user_id = 1;
user_id | firstname | lastname
---------+-----------+----------
1 | carl | luo
References:
http://cassandra.apache.org/download/
I think the conf/cassandra.yaml should be from the sample
Important Makefile will be as follow:
IMAGE=sillycat/public
TAG=ubuntu-cassandra
NAME=ubuntu-cassandra
prepare:
wget http://apache.osuosl.org/cassandra/3.11.4/apache-cassandra-3.11.4-bin.tar.gz -P install/
mkdir logs
mkdir data
docker-context:
build: docker-context
# docker build --no-cache -t $(IMAGE):$(TAG) .
docker build -t $(IMAGE):$(TAG) .
run:
docker run -d -p 127.0.0.1:7000-7001:7000-7001 -p 127.0.0.1:7199:7199 -p 127.0.0.1:9042:9042 -p 127.0.0.1:9160:9160 -v $(shell pwd)/data:/tool/cassandra/data -v $(shell pwd)/logs:/tool/cassandra/logs --name $(NAME) $(IMAGE):$(TAG)
debug:
docker run -ti -p 7000-7001:7000-7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 -v $(shell pwd)/data:/tool/cassandra/data -v $(shell pwd)/logs:/tool/cassandra/logs --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
docker stop ${NAME}
docker rm ${NAME}
logs:
docker logs ${NAME}
publish:
docker push ${IMAGE}:${TAG}
fetch:
docker pull ${IMAGE}:${TAG}
The start.sh will detect the IP for running machine.
#!/bin/sh -ex
#prepare config
INTERNAL_IP="$(hostname --ip-address)"
sed -ri 's/(listen_address:).*/\1 "'"$INTERNAL_IP"'"/' "/tool/cassandra/conf/cassandra.yaml"
#start the cassandra
/tool/cassandra/bin/cassandra -Dcassandra.config=file:///tool/cassandra/conf/cassandra.yaml -R -f
tail -f /tool/cassandra/logs/debug.log
Here is the Dockerfile shows all the steps
#Set up Cassandra in Docker
#Prepare the OS
FROM ubuntu:16.04
MAINTAINER Rachel Kang <yiyikangrachel@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt-get -qq update
RUN apt-get -qqy dist-upgrade
#Prepare the denpendencies
RUN apt-get install -qy wget unzip vim
RUN apt-get install -qy iputils-ping
#Install SUN JAVA
RUN apt-get update && \
apt-get install -y --no-install-recommends locales && \
locale-gen en_US.UTF-8 && \
apt-get dist-upgrade -y && \
apt-get --purge remove openjdk* && \
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
apt-get update && \
apt-get install -y --no-install-recommends oracle-java8-installer oracle-java8-set-default && \
apt-get clean all
#Install the application
WORKDIR /tool/
ADD install/apache-cassandra-3.11.4-bin.tar.gz /tool/
RUN ln -s /tool/apache-cassandra-3.11.4 /tool/cassandra
RUN mkdir /tool/cassandra/logs
RUN mkdir /tool/cassandra/data
ADD conf/cassandra.yaml /tool/cassandra/conf/
#Start the Application
# 7000: intra-node communication
# 7001: TLS intra-node communication
# 7199: JMX
# 9042: CQL
# 9160: thrift service
EXPOSE 7000 7001 7199 9042 9160
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app
CMD [ "./start.sh” ]
Put the command tool in class path
sudo ln -s /Users/hluo/tool/apache-cassandra-3.11.4 /opt/cassandra-3.11.4
Check Version
> cqlsh --version
cqlsh 5.0.1
Connect to localhost
> cqlsh localhost 9042
Verify with an easy sample
Create Database
cqlsh> create keyspace mykeyspace with replication = { 'class': 'SimpleStrategy', 'replication_factor':1};
cqlsh> use mykeyspace;
Create Table
> cqlsh:mykeyspace> create table users ( user_id int primary key, firstname text, lastname text );
Insert Some Data
cqlsh:mykeyspace> insert into users(user_id, firstname, lastname) values (1,'carl','luo');
cqlsh:mykeyspace> insert into users(user_id, firstname, lastname) values (2,'ray','luo');
cqlsh:mykeyspace> insert into users(user_id, firstname, lastname) values (3,'kiko','kang');
Search
select * from users;
user_id | firstname | lastname
---------+-----------+----------
1 | carl | luo
2 | ray | luo
3 | kiko | kang
Create Index
cqlsh:mykeyspace> create index on users (lastname);
Search on Index
select * from users where lastname = 'luo';
user_id | firstname | lastname
---------+-----------+----------
1 | carl | luo
2 | ray | luo
Search with primary key
select * from users where user_id = 1;
user_id | firstname | lastname
---------+-----------+----------
1 | carl | luo
References:
http://cassandra.apache.org/download/
发表评论
-
Update Site will come soon
2021-06-02 04:10 1677I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 315I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 475NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 367Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 368Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 336Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 430Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 435Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 373Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 454VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 384Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 477NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 421Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 337Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 246GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 450GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 326GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 312Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 317Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 292Serverless with NodeJS and Tenc ...
相关推荐
Spring Data for Apache Cassandra API。 Spring Data for Apache Cassandra 开发文档
### Apache Cassandra 掌控指南 #### 一、引言 在大数据时代,高效的数据存储与管理变得至关重要。《Mastering Apache Cassandra》这本书旨在帮助读者掌握 Apache Cassandra 的核心技术和最佳实践,使其能够在处理...
Title: Mastering Apache Cassandra, 2nd Edition Author: Nishant Neeraj Length: 322 pages Edition: 2 Language: English Publisher: Packt Publishing Publication Date: 2015-02-27 ISBN-10: 1784392618 ISBN-...
In Beginning Apache Cassandra Development, author and Cassandra expert Vivek Mishra takes you through using Apache Cassandra from each of these primary languages. Mishra also covers the Cassandra ...
### 学习Apache Cassandra 2015:深入理解NoSQL数据库系统 #### 一、了解Apache Cassandra及其特性 **Apache Cassandra**是一款分布式NoSQL数据库系统,由Facebook开发并在2008年作为开源项目发布。它以Amazon的...
在本文档中,标题“Learning_Apache_Cassandra”透露了内容的主题,即学习Apache Cassandra。Cassandra是一个开源的NoSQL分布式数据库管理系统,它以高可用性和分布式架构著称。该书详细介绍了Cassandra的基本概念、...
Apache Cassandra是一个分布式的NoSQL数据库管理系统,它被设计用来处理大量的数据跨越多个数据中心。Cassandra对高性能、高可用性、可扩展性有着出色的支持,因此它特别适合于那些需要不断增长和变化的数据集的应用...
Learning Apache Cassandra - Second Edition by Sandeep Yarabarla English | 25 Apr. 2017 | ASIN: B01N52R0B5 | 360 Pages | AZW3 | 10.68 MB Key Features Install Cassandra and set up multi-node clusters ...
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 ...
docker-cassandra-群集使用docker的Cassandra的基本集群脚本。 尽管您可以将其启动到docker-machine集群上,但这是为本地开发而设计的。 如果您确实踏上了那趟旅程,请特别注意compose yaml中的端口规格。 它可能...
docker-cassandra, 在 Docker的快速启动中,Cassandra Docker 中的Cassandra这个库提供了在 Docker 中运行Cassandra所需的一切,并为快速的容器启动而调整。为什么?虽然天真的Cassandra图像大约需要 30秒的时间,...
Cassandra(apache-cassandra-3.11.11-bin.tar.gz)是一套开源分布式NoSQL数据库系统。它最初由Facebook开发,用于储存收件箱等简单格式数据,集GoogleBigTable的数据模型与Amazon Dynamo的完全分布式的架构于一身...
Apache Cassandra是一个开源的分布式NoSQL数据库管理系统,它最初由Facebook开发,并在2008年被捐献给了Apache软件基金会。Cassandra旨在解决大规模数据存储的问题,特别适用于那些需要高性能、可伸缩性以及高可用性...
Apache Cassandra 是一个分布式数据库系统,特别设计用于处理大规模数据,具备高可用性、线性可扩展性和优秀的性能。在这个"apache-cassandra-3.11.13"版本中,我们探讨的是Cassandra项目的其中一个稳定版本,它包含...
Apache Cassandra is the perfect choice for building fault tolerant and scalable databases. Implementing Cassandra will enable you to take advantage of its features which include replication of data ...