Search code examples
phpnamespacesaerospike

How to create namespace in Aerospike DB from php client


How can one declare a namespace in Aerospike DB for the default PHP client? I have gone through the documentation at http://www.aerospike.com/docs/client/php but cannot find anything useful.

Although you can find the following code at http://www.aerospike.com/docs/operations/configure/namespace

namespace <namespace-name> {
    # memory-size 4G           # 4GB of memory to be used for index and data
    # replication-factor 2     # For multiple nodes, keep 2 copies of the data
    # high-water-memory-pct 60 # Evict non-zero TTL data if capacity exceeds
                               # 60% of 4GB
    # stop-writes-pct 90       # Stop writes if capacity exceeds 90% of 4GB
    # default-ttl 0            # Writes from client that do not provide a TTL
                               # will default to 0 or never expire
    # storage-engine memory    # Store data in memory only
}

but how do I do it with PHP ?


Solution

  • What you quote above is the configuration file syntax and the namespace stanza (entry) in the configuration file. ( /etc/aerospike/aerospike.conf by default. )

    The only way to create a namespace is by editing the aerospike configuration file and restarting the server. Namespace defines how you will store the data (memory only or SSDs or Files or mem+persistent) and identifies replication factor as well as other default policies. Some of these namespace params have to be identical across all nodes, such as replication factor --its a distributed database! So changes to namespaces (prior to ver 3.13) require cluster wide restart.

    Starting with Ver 3.14, you can do a rolling update to namespaces, node by node and don't have to shut the entire cluster down to modify a namespace.