Search code examples
aerospike

Timeout Exception when querying Aerospike from command line


I'm trying to query the aerospike database from command line. I want to query a set called Users.

$ aql -h remote.myserver.com -p 3000
Aerospike Query Client
Version 3.13.0.1
C Client Version 4.1.6
Copyright 2012-2016 Aerospike. All rights reserved.
aql> select * from test.Users
Error: (9) Timeout: timeout=1000 iterations=1 failedNodes=0 failedConns=0

How can I increase the timeout when I'm using CLI option? This table has merely 27 records only.

Thanks in advance.


Solution

  • 1) On latest aql tool you can use the -T command line option.

    -T, --timeout Set the timeout (ms) for commands. Default: 1000

    aql -u
    aql: option requires an argument -- 'u'
    Aerospike Query Client
    Version 3.15.1.2
    C Client Version 4.3.0
    Copyright 2012-2017 Aerospike. All rights reserved.
    
    Usage: aql [OPTIONS]
    ------------------------------------------------------------------------------
      -V, --version       Print AQL version information.
      -O, --options       Print command-line options message.
      -E, --help          Print command-line options message and AQL commands 
                          documentation.
      -h, --host <host1>[:<tlsname1>][:<port1>],... 
                          Server seed hostnames or IP addresses. The tlsname is 
                          only used when connecting with a secure TLS enabled 
                          server. Default: localhost:3000
                          Examples:
                            host1
                            host1:3000,host2:3000
                            192.168.1.10:cert1:3000,192.168.1.20:cert2:3000
     -p, --port <port>    Server default port. Default: 3000
     -U, --user <name>    User name used to authenticate with cluster. Default: none
     -P, --password[<password>]
                          Password used to authenticate with cluster. Default: none
                          User will be prompted on command line if -P specified and no
                           password is given.
     -c, --command <cmd>  Execute the specified command.
     -f, --file <path>    Execute the commands in the specified file.
     -z, --threadpoolsize <n>
                          Set the number of client threads used to talk to the
                          server. Default: 16
     -e, --echo           Enable echoing of commands. Default: disabled
     -o, --outputmode     Set the output mode. (json | table | raw | mute)
                          Default: table
     -n, --outputtypes    Disable outputting types for values (e.g., GeoJSON, JSON)
                          to distinguish them from generic strings
     -v, --verbose        Enable verbose output. Default: disabled
     -T, --timeout <ms>   Set the timeout (ms) for commands. Default: 1000
     -u, --udfuser <path> Path to User managed UDF modules.
                          Default: /opt/aerospike/usr/udf/lua
     -s, --udfsys <path>  Path to the System managed UDF modules.
                          Default: /opt/aerospike/sys/udf/lua
     --tlsEnable          Enable TLS. # Default: TLS disabled
     --tlsEncryptOnly     Disable TLS certificate verification.
     --tlsCaFile <path>   Set the TLS certificate authority file.
     --tlsCaPath <path>   Set the TLS certificate authority directory.
     --tlsProtocols <protocols>
                          Set the TLS protocol selection criteria.
     --tlsCipherSuite <suite>
                          Set the TLS cipher selection criteria.
     --tlsCrlCheck        Enable CRL checking for leaf certs.
     --tlsCrlCheckAll     Enable CRL checking for all certs.
     --tlsCertBlackList <path>
                          Path to a certificate blacklist file.
     --tlsLogSessionInfo
                          Log TLS connected session info.
     --tlsKeyFile <path>  Set the TLS client key file for mutual authentication.
     --tlsCertFile <path>
                          Set the TLS client certificate chain file for mutual 
                          authentication.
    

    2) Within aql interactive mode you can set the timeout by modifying the

    TIMEOUT setting

    aql> set  TIMEOUT 100000
    TIMEOUT = 100000
    aql> 
    

    Here are the settings that can be modified in interactive mode.

      SETTINGS
            ECHO                          (true | false, default false)
            OUTPUT                        (TABLE | JSON | MUTE | RAW, default TABLE)
            OUTPUT_TYPES                  (true | false, default true)
            TIMEOUT                       (time in ms, default: 1000)
            VERBOSE                       (true | false, default false)
            LUA_USERPATH                  <path>, default : /opt/aerospike/usr/udf/lua
            LUA_SYSPATH                   <path>, default : /opt/aerospike/sys/udf/lua
            USE_SMD                       (true | false, default false)
            RECORD_TTL                    (time in sec, default: 0)
            RECORD_PRINT_METADATA         (true | false, default false, prints record metadata)
            REPLICA_ANY                   (true | false, default false)
            KEY_SEND                      (true | false, default false)
            DURABLE_DELETE                (true | false, default false)
            FAIL_ON_CLUSTER_CHANGE        (true | false, default true, policy applies to scans)
            SCAN_PRIORITY                 priority of scan (LOW, MEDIUM, HIGH, AUTO), default : AUTO
            NO_BINS                       (true | false, default false, No bins as part of scan and query result)
            LINEARIZE_READ                (true | false, default false, Make read linearizable, applicable only for namespace with strong_consistency enabled.)
    

    3) Above settings can also be set within an aql script and called using

    aql -f <aql_script>

    $ cat test.aql 
    INSERT INTO test.demo (PK, foo, bar) VALUES ('key1', 123, 'abc')
    SET TIMEOUT 150000
    select * from test.demo
    
    $ aql -f test.aql 
    INSERT INTO test.demo (PK, foo, bar) VALUES ('key1', 123, 'abc')
    OK, 1 record affected.
    
    SET TIMEOUT 150000
    TIMEOUT = 150000
    select * from test.demo
    +-----+-------+
    | foo | bar   |
    +-----+-------+
    | 123 | "abc" |
    +-----+-------+
    1 row in set (0.392 secs)