---
title: "Multiple database instances"
description: "Guide to running multiple independent Aerospike Daemon (asd) instances on a single node for NUMA optimization."
---

# Multiple database instances

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

It is possible to run multiple, independent Aerospike Daemon instances on a single node. One use case for running multiple Aerospike instances is to leverage the [auto-pin numa](https://aerospike.com/docs/database/reference/config#service__auto-pin) configuration option which requires the `asd` process to be pinned to a non-uniform memory access (NUMA) node.

Use the following procedure to run multiple `asd` instances:

1.  **Create a custom service file with parameter**
    
    By default, the Aerospike service file is located at `/usr/lib/systemd/system/aerospike.service`. Move the original to another location. Create a new file in the format `SERVICE-NAME@.service` in the `/usr/lib/systemd/system` directory. For the remainder of this procedure, we will use a file named `aerospike_X@.service`.
    
    The following is an example of a custom service file located at `/usr/lib/systemd/system/aerospike_X@.service`:
    
    ```plaintext
    [Unit]
    
    Description=Aerospike Server %I
    
    After=network.target
    
    Wants=network.target
    
    [Service]
    
    LimitNOFILE=100000
    
    TimeoutSec=15
    
    User=root
    
    Group=root
    
    EnvironmentFile=/etc/sysconfig/aerospike
    
    PermissionsStartOnly=True
    
    ExecStartPre=/usr/bin/asd-systemd-helper
    
    ExecStart=/usr/bin/asd $ASD_OPTIONS --config-file  /etc/aerospike/aerospike%i.conf --fgdaemon --instance %i
    
    [Install]
    
    WantedBy=multi-user.target
    ```
    
2.  **Copy configuration files**
    
    By default, the Aerospike configuration file is located at `/etc/aerospike/aerospike.conf`. Create a copy for each `asd` instance you intend to run:
    
    ```plaintext
    cp /etc/aerospike/aerospike.conf /etc/aerospike/aerospike1.conf
    
    cp /etc/aerospike/aerospike.conf /etc/aerospike/aerospike2.conf
    ```
    
3.  **Set the `mod-lua` path on each of those files to the new locations**
    
    For `aerospike1.conf`:
    
    ```plaintext
    mod-lua {
    
         user-path /opt1/aerospike/usr/udf/lua/
    
    }
    ```
    
    For `aerospike2.conf`:
    
    ```plaintext
    mod-lua {
    
         user-path /opt2/aerospike/usr/udf/lua/
    
    }
    ```
    
4.  **Modify the work-directory paths**
    
    The `work-directory` parameter in each configuration file should point to a different location:
    
    ```plaintext
    work-directory /opt1/aerospike
    ```
    
    and
    
    ```plaintext
    work-directory /opt2/aerospike
    ```
    
5.  **Modify port settings to be unique**
    
    By default, the Aerospike configuration file specifies port 3000 for Aerospike’s use. In each of the new configuration files, ensure that the service port is unique.
    
6.  **Validate the instances**
    
    Run the following commands to verify that `systemctl` can find the services.
    
    ```plaintext
    systemctl status aerospike_X@1.service
    
    systemctl status aerospike_X@2.service
    ```
    
    Expected output:
    
    ```plaintext
    aerospike_X@1.service - Aerospike Server 1 Loaded: loaded (/lib/systemd/system/aerospike_X@.service; disabled; vendor> Active: inactive (dead)
    ```
    
7.  **Enable the new services**
    
    ```plaintext
    systemctl enable aerospike_X@1.service
    
    systemctl enable aerospike_X@2.service
    ```
    
8.  **Start the new services**
    
    ```plaintext
    systemctl start aerospike_X@1.service
    
    systemctl start aerospike_X@2.service
    ```
    

We recommend that you enable [rack awareness](https://aerospike.com/docs/database/8.0.0/learn/architecture/clustering/rack-aware) when running multiple `asd` instances on a physical host. `asd` instances on the same host should be part of the [same rack](https://aerospike.com/docs/database/reference/config#namespace__rack-id).