Skip to main content
Loading

Multiple asd Instances

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 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:

    [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:

    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:

    mod-lua {
    user-path /opt1/aerospike/usr/udf/lua/
    }

    For aerospike2.conf:

    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:

    work-directory /opt1/aerospike

    and

    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.

    systemctl status aerospike_X@1.service
    systemctl status aerospike_X@2.service

    Expected output:

    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

    systemctl enable aerospike_X@1.service
    systemctl enable aerospike_X@2.service
  8. Start the new services

    systemctl start aerospike_X@1.service
    systemctl start aerospike_X@2.service

We recommend that you enable rack awareness when running multiple asd instances on a physical host. asd instances on the same host should be part of the same rack.