命名空间存储配置(Namespace Storage Configuration)

aerospike决定在哪里存储数据的存储引擎配置是基于命名空间的,这些引擎确定数据将被保存到磁盘,驻留在内存或者基于磁盘和内存的混合存储。这些决定将会影响持久性,成本和集群的性能。



Support for Multi-Bin(支持多个bin)
Supports full Aerospike data Model (支持所有的Aerospike数据模型)
Survive a Power Outage(停电时保持数据)
Fast Restarts(快速重启)
Support for XDR(支持跨数据中心复制)
Index in Memory(在内存中索引)

存储引擎配置方法
下面的方法需要修改Aerospike在/etc/aerospike/aerospike.conf的服务器的配置文件。
开始,在您喜欢的编辑器中打开配置文件并做相应的更改。

SSD存储引擎的方法
namespace <namespace-name> {
    memory-size <SIZE>G         # Maximum memory allocation for primary# and secondary indexes.(最大内存分配给主索引和二级索引)
    storage-engine device {     # Configure the storage-engine to use persistence(配置存储引擎使用的持久性)
        device /dev/<device>    # raw device. Maximum size is 2 TiB(原始设备,最大的大小为2TB)# device /dev/<device> # (optional) another raw device.可选,其它设备
        write-block-size 128K   # adjust block size to make it efficient for SSDs.(调整block大小使SSD使用更高效)
    }
}


磁盘存储和内存存储的方法
namespace <namespace-name> {
    memory-size <SIZE>G             # Maximum memory allocation for data and# primary and secondary indexes.
(最大内存分配给主索引和二级索引)

storage-engine device { # Configure the storage-engine to use# persistence. Maximum size is 2 TiB(配置存储引擎使用的持久性。最大尺寸是2 TiB file /opt/aerospike/<filename> # Location of data file on server.(数据文件在服务器中的位置)# file /opt/aerospike/<another> # (optional) Location of data file on server. filesize <SIZE>G # Max size of each file in GiB. data-in-memory true# Indicates that all data should also be# in memory.(表明所有数据也应该在内存中) }}



磁盘存储引擎和数据索引引擎的方法
namespace <namespace-name> {
    memory-size <N>G                # Maximum memory allocation for data and# primary and secondary indexes.
    single-bin true# Required true by data-in-index.
    data-in-index true# Enables in index integer store.
    storage-engine device {         # Configure the storage-engine to use# persistence.
    file /opt/aerospike/<filename>  # Location of data file on server.# file /opt/aerospike/<another> # (optimal) Location of data file on server.# device /dev/<device> # Optional alternative to using files.

    filesize <SIZE>G               # Max size of each file in GiB. Maximum size is 2TiB
    data-in-memory true# Required true by data-in-index.
    }
}


数据在内存中没有持久化的方法
namespace <namespace-name> {
    memory-size <SIZE>G   # Maximum memory allocation for data and primary and# secondary indexes.
    storage-engine memory # Configure the storage-engine to not use persistence.(配置存储引擎为不使用持久化)
}


命名空间数据保留策略
namespace <namespace-name> {
    default-ttl <VALUE>             # How long (in seconds) to keep data after# it is written
    high-water-disk-pct <PERCENT>   # How full may the disk become before the# server begins eviction (expiring records# early)
    high-water-memory-pct <PERCENT> # How full may the memory become before the# server begins eviction (expiring records# early)
    stop-writes-pct <PERCENT>       # How full may the memory become before# we disallow new writes
    ...
}


set的数据保持
namespace <namespace-name> {
    ...
    set <set-name> {
        set-evict-hwm-count <COUNT>   # How many records may reside in this set# before the server begins evicting# records from this setset-stop-writes-count <COUNT> # How many records may be in this set# before the server begins rejecting# writes to this set
    }
}


Intracluster Replication

namespace <namespace-name> {
    ...
    replication-factor 2 ...
}




服务器要求
Dell PowerEdge 12G R720 :
2 *  CPU Xeon E5-2650 V2 ;
24 * 内存为:ECC 8G (单条):
1 * SSD 商用240G
7 * 硬盘为: 3.5 SAS 15K 600G, 硬盘做RAID5;
RAID卡为:PERC H710P ; 
Intel四端口千兆网卡 ;
iDRAC6远程管理卡;
电源: 双电 750W;
操作系统版本:centos 6.7 liunx内核3.1以上



single-bin

设置为true时将不允许有多个bin的记录

data-in-index

优化单个bin的情况,将只允许整数存储在索引空间


cluster {
    mode static #static:node-id必须是静态分配,dynamic:node-id基于本地ip地址动态选择,none:不要使用机架感应
    self-node-id  101 #识别单个节点,在同一个组内必须是唯一的
    #self-node-id  301
    self-group-id 201 #确定节点的集合,同一个组里面的节点将没有副本
}
集群背景下需要paxos-protocol v4。

logging {
  # Log file must be an absolute path.
  file /data/server/aerospike-server/bin/var/log/aerospike.log {
    context any info
  }
}
logging {
 file /var/log/aerospike/aerospike.log { context any info } file /var/log/aerospike/aerospike_debug.log { context any debug }
}

mod-lua {
  system-path /data/server/aerospike-server/bin/share/udf/lua #系统默认函数
  user-path /data/server/aerospike-server/bin/var/udf/lua #用户自定义函数
}

namespace test {
  replication-factor 2
  #memory-size 8G
  #default-ttl 30d # 30 days, use 0 to never expire/evict.
  #storage-engine memory
  memory-size 8G
  storage-engine device {
  file /opt/aerospike/data.bat
  filesize 20G
  data-in-memory true # 永远保持一份所有数据在内存中。默认为false
  }
}






你可能感兴趣的:(命名空间存储配置(Namespace Storage Configuration))