从命令行查询 Aerospike 时的超时异常



>我正在尝试从命令行查询 aerospike 数据库。我想查询一个名为"用户"的集合。

$ 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

如何在使用 CLI 选项时增加超时?此表只有 27 条记录。

提前谢谢。

1( 在最新的 aql 工具上,您可以使用 -T 命令行选项。

-T, --timeout 设置命令的超时时间(毫秒(。默认值: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( 在 aql 交互模式下,您可以通过修改

超时设置

aql> set  TIMEOUT 100000
TIMEOUT = 100000
aql> 

以下是可以在交互模式下修改的设置。

  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( 上述设置也可以在 aql 脚本中设置并使用

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)

最新更新