Function connect

  • Creates a new Client instance and connects to the Aerospike cluster.

    Parameters

    Returns Promise<Client>

    A Promise resolving to the connected client.

    const Aerospike = require('aerospike')

    // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
    var config = {
    hosts: '192.168.33.10:3000',
    }

    Aerospike.connect(config, (err, client) => {
    console.log("Connected. Closing now.")
    client.close()
    })
    const Aerospike = require('aerospike')

    // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
    var config = {
    hosts: '192.168.33.10:3000',
    }
    Aerospike.connect(config, (error, client) => {
    if (error) {
    console.error('Failed to connect to cluster: %s', error.message)
    process.exit()
    } else {
    // client is ready to accept commands
    console.log("Connected. Now closing connection.")
    client.close()
    }
    })
    const Aerospike = require('aerospike')
    // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
    var config = {
    hosts: '192.168.33.10:3000',
    }
    Aerospike.connect(config)
    .then(client => {
    // client is ready to accept commands
    console.log("Connected. Now Closing Connection.")
    client.close()
    })
    .catch(error => {
    console.error('Failed to connect to cluster: %s', error.message)
    })
  • Parameters

    • callback: TypedCallback<Client>

      The function to call, once the client is connected to the cluster successfully.

    Returns Client

  • Parameters

    • config: ConfigOptions

      The configuration for the client.

    • callback: TypedCallback<Client>

      The function to call, once the client is connected to the cluster successfully.

    Returns Client

MMNEPVFCICPMFPCPTTAAATR