欢迎投稿

今日深度:

Ubuntu安装Cassandra,ubuntucassandra

Ubuntu安装Cassandra,ubuntucassandra


因kong网管需要配置数据库,考虑到高可用的问题,选择Cassandra数据库,安装过程记录如下
Cassandra单节点安装,Cassandra集群安装

前置条件

需要安装jdk,jdk的安装
环境版本号
jdk jdk-8u171
Ubuntu 16.04.3

下载Cassandra数据库

http://cassandra.apache.org/download/

解压文件

tar -zxvf apache-cassandra-3.11.3-bin.tar.gz
cd ./apache-cassandra-3.11.3/bin

启动Cassandra数据库

./cassandra -R 制定root用户启动

cassandra启动后会有日志打印

连接Cassandra

./cqlsh

help查看,会看到一下信息

至此,Cassandra数据库安装完成

创建keyspace

CREATE KEYSPACE keyspace_01 WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};

Replication Factor : 复制因数。 表示一份数据在一个DC 之中包含几份。常用奇数。Replica placement strategy : 复制策略。 默认的是SimpleStrategy. 如果是单机架、单数据中心的模式,保持使用SimpleStrtegy即可。

使用keyspace

USE keyspace_01;

创建table

CREATE TABLE user ( name text, age int, PRIMARY KEY (name));


添加数据

INSERT INTO user (name,age) VALUES ('rose',18);

查询数据

select * from user;

www.htsjk.Com true http://www.htsjk.com/cassandra/33325.html NewsArticle Ubuntu安装Cassandra,ubuntucassandra 因kong网管需要配置数据库,考虑到高可用的问题,选择Cassandra数据库,安装过程记录如下 Cassandra单节点安装,Cassandra集群安装 前置条件 需要安装jdk,j...
相关文章
    暂无相关文章
评论暂时关闭