Cockroachdb 三、副本设置

三 副本配置

CockroachDB 副本配置可分为三个等级,集群级别>数据库级别>表级别

格式 YAML

range_min_bytes: <size-in-bytes> //
range_max_bytes: <size-in-bytes> // 默认64M
gc:
ttlseconds: <time-in-seconds> //默认24h
num_replicas: <number-of-replicas> //默认3
constraints: [comma-separated constraint list] //由于指定区域或存储类型

constraints 特别说明

a 节点启动时属性描述 cockroach start

--locality 举例:--locality=region=east,datacenter=us-east-1
--attrs 举例:--attrs=ram:64gb、ssd、hhd

--store attrs 举例: --store=path=/mnt/ssd01,attrs=ssd 、 --store=path=/mnt/hda1,attrs=hdd:7200rpm

b 语法
constraints:[+ssd] 使用
constraints:[-ssd] 禁用

基本命令
# View the replication zone for a database:
cockroach zone get <database> <flags>

# View the replication zone for a table:
cockroach zone get <database.table> <flags>

# Edit the default replication zone for the cluster:
cockroach zone set .default --file=<zone-content.yaml> <flags>

# Create/edit the replication zone for a database:
cockroach zone set <database> --file=<zone-conent.yaml> <flags>

# Create/edit the replication zone for a table:
cockroach zone set <database.table> --file=<zone-content.yaml> <flags>

# Remove the replication zone for a database:
cockroach zone rm <database> <flags>

# Remove the replication zone for a table:
cockroach zone rm <database.table> <flags>

应用场景举例

转载于:https://www.cnblogs.com/zhangeamon/p/7338161.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值