Aerospike 集群搭建

背景

原本使用redis,但是redis cluster不是很成熟,选用了相似的Aerospike

配置文件

默认配置文件地址

vim /etc/aerospike/aerospike.conf
# Aerospike database configuration file.

service {
    user root
    group root
    paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
    pidfile /var/run/aerospike/asd.pid
    service-threads 4
    transaction-queues 4
    transaction-threads-per-queue 4
    proto-fd-max 15000
}

logging {
    # Log file must be an absolute path.
    file /var/log/aerospike/aerospike.log {
        context any info
    }
}

network {
    service {
        address any
        port 3000
    }

    heartbeat {
        mode mesh
        address 10.100.1.235
        port 3102

        # To use unicast-mesh heartbeats, remove the 3 lines above, and see
        # aerospike_mesh.conf for alternative.
        #mesh-seed-address-port 10.100.1.170 3102
        #mesh-seed-address-port 10.100.1.190 3102
        #mesh-seed-address-port 10.100.1.116 3102
        interval 150
        timeout 10
    }

    fabric {
        port 3101
    }

    info {
        port 3103
    }
}


namespace dfp {
    replication-factor 2     #一般为2,最大不超过3
    memory-size 4G
    default-ttl 0 # 30 days, use 0 to never expire/evict.

    storage-engine memory

    # To use file storage backing, comment out the line above and use the
    # following lines instead.
#   storage-engine device {
#       file /opt/aerospike/data/bar.dat
#       filesize 16G
#       data-in-memory true # Store data in memory in addition to file.
#   }
}

当需要单节点时,注释掉 heartbeat中其他的节点

需要多节点时,在heartbeat中添加即可

不过需要注意的是复制因子replication-factor 2,最大不超过3,否则会引起性能的急剧下降

保存配置后,重启并查看aerospike状态

/etc/init.d/aerospike restart
/etc/init.d/aerospike status

你可能感兴趣的:(Aerospike 集群搭建)