自从Crate有了合理的默认值,再也不需要为使用基本功能而进行任何配置。

Crate以配置文件配置为主,它位于config/crate.yml。标准的配置文件有默认的有效配置以及注释,可以随着包一起分发。

可以像这样启动时指定配置文件:

sh$ ./bin/crate -Des.path.home=/path/to/config/directory

任何配置项都可以通过配置文件或系统属性进行配置。如果使用系统属性文件配置,参数前缀‘es.(这有个点)’会被忽略。

例如,使用系统属性配置集群的名称将使用如下:

sh$ ./bin/crate -Des.cluster.name=cluster

这和在配置文件中设置集群名称是一样的。

cluster.name = cluster

这些设置配置文件将按照以下的顺序生效,后面的将会覆盖前面的配置

internal defaults(内部默认值) system properties(系统属性) options from config file(配置文件) command-line properties(命令行)

Table Settings(表设置)

更多的关于如何创建表的语法请参考CREATE TABLE

number_of_replicas(复制份数)

Default: 1
Runtime: yes
指定正常情况下每个表的每个分片的复制份数

refresh_interval

Default: 1000
Runtime: yes
指定每个分片的刷新间隔,以毫秒为单位

Blocks

blocks.read_only

Default: false
Runtime: yes
若果设置为true,表将会只读,而且不允许写,更新和删除操作。这和设置blocks.read和blocks.metadata这两个属性为true效果是一样的。

blocks.read

Default: false
Runtime: yes
若果设置为true,将不允许对此表进行读操作(包括做导出和快照)。

blocks.write

Default: false
Runtime: yes
如果设置为true,将不允许写操作。

blocks.metadata

Default: false
Runtime: yes
如果设置为true,alter和drop操作将不允许。这里有一个例外: 仅仅设置一个block.*的设置依然允许alter来更改blocks的设置。

Translog

注意

translog提供一个对所有尚未刷新到磁盘的操作的持久化日志。无论何时一行记录插入到一张表(或者更新)的变化将同时被添加到内存缓冲区和translog中。当translog达到一个确切的大小(查看 flush.threshold.size),或者持有一个确切数量的操作(查看 flush.threshold.ops),或者达到一个合适的间隔(查看 flush.threshold.period)translog已经同步,刷新到磁盘,并清除。

translog.flush_threshold_ops

Default: unlimited
Runtime: yes
设置translog刷新前的操作数

translog.flush_threshold_size

Default: 200mb
Runtime: yes
设置translog的刷新阈值,默认是200mb。

translog.flush_threshold_period

Default: 30m
Runtime: yes
设置达到flushing的时间间隔,强制落盘。

translog.disable_flush

Default: false Runtime: yes Disable/enable flushing.

关闭或启用flushing

translog.interval

Default: 5s
Runtime: yes
检查是否需要flush的频率,随机在间隔时间和两倍的间隔时间之间。

translog.sync_interval

Default: 5s
Runtime: no
设置index.translog.sync_interval控制translog同步到磁盘后的周期,默认周期是5秒。当设置此间隔,请注在此间隔周期之间的变化将会被记录,不会同步到磁盘,这些变化可能会在记录失败 失败的情况下丢失。

Allocation(分配表分片)

routing.allocation.enable

Default: all Runtime: yes Allowed Values: all | primaries | new_primaries | none 控制对特定表的分片规则

routing.allocation.total_shards_per_node

Default: -1 (unbounded)
Runtime: yes
控制一个节点上允许的总的分片数。

Recovery

recovery.initial_shards

Default: quorum
Runtime: yes
当使用本地网关,一个特殊的分片将会恢复仅当它在集群间的拷贝份数达到法定数。查看recovery.initial_shards可获取更详细的说明。

Warmer(预热)

warmer.enabled

Default: true
Runtime: yes
禁用或启用表预热。表预热允许执行注册的查询语句在表可用之前预热一下表。

Unassigned

unassigned.node_left.delayed_timeout

Default: 1m
Runtime: yes
延迟分配因为一个节点丢失使复制分片变成未分配的分片,默认值是1分钟,为了给节点完全重启的时间。将超时时间设置为0将会立即开始分配。为了增加或减少延迟时间,这个设置可以在运行期间改变。

Column Policy(列规则)

column_policy

Default: dynamic
Runtime: yes
指定表的列规则

results matching ""

    No results matching ""