首页  

aerospike数据库配置     所属分类 aerospike 浏览量 2242
/etc/aerospike/aerospike.conf

配置参数列表
https://www.aerospike.com/docs/reference/configuration/


 aerospike数据逐出与停止写入相关参数  
 
 service {}               # Tuning parameters and process owner
logging{}
# Used to configure intracluster and application-node communications
network {                
    service {}           # Tools/Application communications protocol
    fabric {}            # Intracluster communications protocol
    info {}              # Administrator telnet console protocol
    heartbeat {}         # Cluster formation protocol
}

# (Optional) Configure rack-aware clustering
cluster {}               
# (Aerospike Enterprise only) Configure Cross Datacenter Replication
xdr { 
    # Remote datacenter node list                   
    datacenter  $name {} 
}
# Define namespace record policies and storage engine
namespace $name {       
    storage {}           # Configure persistence or lack of persistence
    set {}               # (Optional) Set specific record policies
}

logging {
	file /opt/aerospike/aerospike.log {
		context any info
	}
}

heartbeat  
multicast  
mesh (Unicast)

server 
server服务端口:应用、工具、远程XDR通过此端口访问AS集群。

Fabric 
Fabric端口:集群内部通讯、备份等操作端口。

info 
Telnet端口,实现了管理发布信息的命令文本协议端口。

Heartbeat 
集群心跳端口,用来构建和维护集群。两种心跳模式:
Multicast Heartbeat:基于UDP的模式
Mesh (Unicast) Heartbeat 基于TCP的模式
上述两种模式只能选其一

一个namespace相当于一个数据库
可以配置多个namespace,一个AS集群最多只能容纳32个namespace

副本数 replication-factor 2

数据有效期
namespace可以配置数据的有效时长,过时的数据自动清理。

default-ttl 数据保留的时长,单位秒
high-water-disk-pct 持久化数据达到总容量的百分比后开始清理数据
high-water-memory-pct 内存数据达到总容量的百分比后开始清理数据
stop-writes-pct 数据达到总容量的百分比后停止写入数据

设置某个set不被清洗
namespace $namespace-name {
    ...
    set $set-name {
        # Protect this set from evictions.
        set-disable-eviction true     
    }
}

设置某个set最多容纳的记录数(record)
namespace $namespace-name {
    ...
    set $set-name {
        # Limit number of records that can be written to this set to 5000.
        set-stop-writes-count 5000    
    }
}

存储方式 数据存放  内存 磁盘 混合存储

SSD存储方案
SSD存储方案必须配置SSD设备,每个设备最大支持2TB,如果有大于2TB的设备,那么把它进行分区,配置为多个设备。
同时,建议将write-block-size配置从默认的1M减少到128K

namespace $namespace-name {
    # Maximum memory allocation for primary and secondary indexes.
    memory-size $SIZE G        
    storage-engine device {     # Configure the storage-engine to use persistence
        device /dev/$device     # raw device. Maximum size is 2 TiB
        # device /dev/$device  # (optional) another raw device.
        write-block-size 128K   # adjust block size to make it efficient for SSDs.
    }
}

HDD及内存混合存储方案
HDD及内存混合存储方案必须配置数据存储的文件路径、每个文件大小(通常是内存大小的4倍,最大为2TB)。同时设置data-in-memory设置为true,开启内存存储机制。

namespace $namespace-name {
    memory-size $SIZEG             # 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
    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.
    # Indicates that all data should also be  in memory.
    data-in-memory true            
    }
}

纯内存模式 

storage-engine memory 



HDD及索引储存方案
这类储存方案比较特殊,适用于你的数据库只有单个bin, 有内存储存的性能同时不失去企业版提供的快速重启恢复数据的能力

namespace $namespace-name {
    # Maximum memory allocation for data and  primary and secondary indexes.
    memory-size $N G                
    single-bin true                 # Required true by data-in-index.
    data-in-index true              # Enables in index integer store.
    # Configure the storage-engine to use persistence.
    storage-engine device {         
    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.
    }
}



完整的配置


service {
	paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
	proto-fd-max 15000
}

logging {
	file /opt/aerospike/aerospike.log {
		context any info
	}
}

network {
	service {
		address any
		port 3000
	}

	heartbeat {
		#mode multicast
		#multicast-group 239.1.99.222
		#port 9918

		# To use unicast-mesh heartbeats, remove the 3 lines above, and see
		# aerospike_mesh.conf for alternative.
                
                mode mesh

                address 10.57.34.21
                port 3002

                mesh-seed-address-port 10.57.34.20 3002
                mesh-seed-address-port 10.57.34.21 3002
                mesh-seed-address-port 10.57.34.22 3002

		interval 150
		timeout 10
	}

	fabric {
		port 3001
	}

	info {
		port 3003
	}
}

namespace ns1 {
  replication-factor 1
  memory-size 16G
  default-ttl 30d # 30 days, use 0 to never expire/evict.
  #storage-engine memory
  transaction-pending-limit 0
  storage-engine device {         
          file /opt/aerospike/data1.dat   
          filesize 128G               
          data-in-memory true            
  }
}

上一篇     下一篇
2018年InfoWorld最佳开源数据平台

2018年度十大网络用语

那些年ofo的广告文案

技术文章合集2

aerospike简单介绍

curl实用技巧