Mesh Subnet Scan

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

Synopsis: Mesh Subnet Scan

In the case of a subnet where all nodes are using DHCP (i.e. AWS), it can be difficult to configure the network context in the aerospike.conf file. Should one add the entire subnet as a precaution because we do not know the IPs our nodes we will have your log will be filled with messages like these: WARNING (cf:socket): (socket.c::368) Error in delayed connect(): timed out

We can create a small command to scan the subnet and use Aerospikes tip command to help us out.

NOTE: Do not use this command if you have multiple independent cluster running in the same subnet.

#! /bin/bash
IP=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' | awk -F "." '{print $1"."$2"."$3"."}'`
for i in {1..254};do asinfo -v "tip:host=$IP$i;port=3002";done

Simply add this to an executable file and execute each time you start/restart the Aerospike Service.

As an example:

[root@localhost ~]# service aerospike restart && sleep 10 && ./findnodes

We have added a sleep 10 there to make sure the Aerospike daemon is ready which you can see in the /var/log/aerospike/aerospike.log file if you look for service ready: soon there will be cake!