欢迎投稿

今日深度:

Cassandra Keyspace storage configuration 整理,cassandrakeyspace

Cassandra Keyspace storage configuration 整理,cassandrakeyspace


整理了一下Cassandra官方文档提供的信息

Cassandra版本:2.0


Synopsis

CREATE ( KEYSPACE | SCHEMA ) IF NOT EXISTS keyspace_name 
WITH REPLICATION = map
AND DURABLE_WRITES = ( true | false )

map is a map collection, a JSON-style array of literals:

{ literal : literal, literal : literal ... }

Keyspace attributes

A keyspace must have a user-defined name, a replica placement strategy, and options that specify the number of copies per data center or node.

Attribute Default value
name NA
placement_strategy SimpleStrategy
strategy_options N/A (container attribute)
durable_writes N/A (container attribute)

name keyspace 的名字,必须填写。 placement_strategy 布局策略有两种 详细http://www.datastax.com/documentation/cassandra/2.0/webhelp/cassandra/architecture/architectureDataDistributeReplication_c.html#concept_ds_yt4_m4f_fk
  • SimpleStrategy or org.apache.cassandra.locator.SimpleStrategy
  • NetworkTopologyStrategy or org.apache.cassandra.locator.NetworkTopologyStrategy
SimpleStrategy :用于单个数据中心,默认 NetworkTopologyStrategy  :用于集群的多个中心
strategy_options
对于复制因子的配置,配置一行记录有多少副本在不同的节点。 如果placement_strategy配置的 SimpleStrategy 就应该配置为 stragegy_options={'replication_factor','1'} 的格式 如果配置的是NetworkTopologyStrategy  应该配置为strategy_options = {'DC1' : 1 , 'DC2' : 1} 的格式,DC1,DC2为 data center name
durable_writers
配置写操作不会绕过commit.log,默认为true,如果设置为false,会有风险

如果不用cql来创建: CREATE KEYSPACE mykeyspace
with placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy'
and strategy_options = {'DC1' : 1 , 'DC2' : 1}
and durable_writes = true;


使用cql来创建:
CREATE KEYSPACE mykeyspace
           WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1' : 1, 'DC2' : 1}
            AND durable_writes = true;
参数详情:
Property Value Value Description
'class' 'SimpleStrategy' or 'NetworkTopologyStrategy' Required. The name of the replica placement strategy class for the new keyspace.
'replication_factor' An integer Required if class is SimpleStrategy; otherwise, not used. The number of replicas of data on multiple nodes.
'<data center name>' An integer Required if class is NetworkTopologyStrategy; otherwise, not used. The number of replicas of data on each node in the data center.
'<data center name>' An integer Optional if class is NetworkTopologyStrategy. The number of replicas of data on each node in the data center.
. . . . . . More optional replication factors for additional named data centers.


www.htsjk.Com true http://www.htsjk.com/cassandra/34310.html NewsArticle Cassandra Keyspace storage configuration 整理,cassandrakeyspace 整理了一下Cassandra官方文档提供的信息 Cassandra版本:2.0 Synopsis CREATE ( KEYSPACE | SCHEMA ) IF NOT EXISTS keyspace_name WITH REPLICATION = map AND DURAB...
相关文章
    暂无相关文章
评论暂时关闭