[[email protected] bin]# aql --help Usage: aql OPTIONS OPTIONS -h <host> The hostname to the server connect to. Default: 127.0.0.1 -p <port> The port number of the server to connect to. Default: 3000 -U <user name> User name used to authenticate with cluster. Default: none -P[<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> Execute the specified command. -f <filepath> Execute the commands in the specified file. -v Enable verbose output. Default: disabled -e Enable echoing of commands. Default disabled -M Result display disabled. Default display enabled -q Scan queue size. Default 3 -T <milliseconds> Set the timeout (ms) for commands. Default: 1000 -S Enable SLAP mode for queries. Default: disabled -t <n> Number of batch threads for SLAP mode. Default: 10 -i <n> Number of iterations per thread for SLAP mode. Default: 10 -o (json | table) Set the output mode. Default: table -F <file path> Set output file path. Default: /dev/null -u <path> Path to User managed UDF modules. Default: /opt/aerospike/usr/udf/lua -s <path> Path to the System managed UDF modules. Default: /opt/aerospike/sys/udf/lua -d Run in debug mode. --help Prints this message. COMMANDS DDL CREATE INDEX <index> ON <ns>[.<set>] (<bin>) NUMERIC|STRING CREATE LIST/MAPKEYS/MAVALUES INDEX <index> ON <ns>[.<set>] (<bin>) NUMERIC|STRING DROP INDEX <ns>[.<set>] <index> REPAIR INDEX <index> ON <ns>[.<set>] <ns> is the namespace for the index. <set> is the set name for the index. <index> is the name of the index. Examples: CREATE INDEX idx_foo ON test.demo (foo) NUMERIC DROP INDEX test.demo idx_foo REPAIR INDEX idx_foo ON test.demo DML INSERT INTO <ns>[.<set>] (PK, <bins>) VALUES (<key>, <values>) DELETE FROM <ns>[.<set>] WHERE PK = <key> <ns> is the namespace for the record. <set> is the set name for the record. <key> is the record‘s primary key. <key> is the record‘s primary key. <bins> is a comma-separated list of bin names. <values> is comma-separated list of bin values. Keep it NULL (case insensitive & w/o quotes) to delete the bin Examples: INSERT INTO test.demo (PK, foo, bar) VALUES (‘key1‘, 123, ‘abc‘) DELETE FROM test.demo WHERE PK = ‘key1‘ QUERY SELECT <bins> FROM <ns>[.<set>] SELECT <bins> FROM <ns>[.<set>] WHERE <bin> = <value> SELECT <bins> FROM <ns>[.<set>] WHERE <bin> BETWEEN <lower> AND <upper> SELECT <bins> FROM <ns>[.<set>] WHERE PK = <key> SELECT <bins> FROM <ns>[.<set>] IN <indextype> WHERE <bin> = <value> SELECT <bins> FROM <ns>[.<set>] IN <indextype> WHERE <bin> BETWEEN <lower> AND <upper> <ns> is the namespace for the records to be queried. <set> is the set name for the record to be queried. <key> is the record‘s primary key. <bin> is the name of a bin. <value> is the value of a bin. <indextype> is the type of a index user wants to query. (LIST/MAPKEYS/MAPVALUES) <bins> can be either a wildcard (*) or a comma-separated list of bin names. <lower> is the lower bound for a numeric range query. <upper> is the lower bound for a numeric range query. Examples: SELECT * FROM test.demo SELECT * FROM test.demo WHERE PK = ‘key1‘ SELECT foo, bar FROM test.demo WHERE PK = ‘key1‘ SELECT foo, bar FROM test.demo WHERE foo = 123 SELECT foo, bar FROM test.demo WHERE foo BETWEEN 0 AND 999 MANAGE UDFS REGISTER MODULE ‘<filepath>‘ SHOW MODULES REMOVE MODULE <filename> DESC MODULE <filename> <filepath> is file path to the UDF module(in single quotes). <filename> is file name of the UDF module. Examples: REGISTER MODULE ‘~/test.lua‘ SHOW MODULES DESC MODULE test.lua REMOVE MODULE test.lua INVOKING UDFS EXECUTE <module>.<function>(<args>) ON <ns>[.<set>] EXECUTE <module>.<function>(<args>) ON <ns>[.<set>] WHERE PK = <key> AGGREGATE <module>.<function>(<args>) ON <ns>[.<set>] WHERE <bin> = <value> AGGREGATE <module>.<function>(<args>) ON <ns>[.<set>] WHERE <bin> BETWEEN <lower> AND <upper> <module> is UDF module containing the function to invoke. <function> is UDF to invoke. <args> is a comma-separated list of argument values for the UDF. <ns> is the namespace for the records to be queried. <set> is the set name for the record to be queried. <key> is the record‘s primary key. <bin> is the name of a bin. <value> is the value of a bin. <lower> is the lower bound for a numeric range query. <upper> is the lower bound for a numeric range query. Examples: EXECUTE myudfs.udf1(2) ON test.demo EXECUTE myudfs.udf1(2) ON test.demo WHERE PK = ‘key1‘ AGGREGATE myudfs.udf2(2) ON test.demo WHERE foo = 123 AGGREGATE myudfs.udf2(2) ON test.demo WHERE foo BETWEEN 0 AND 999 INFO SHOW NAMESPACES | SETS | BINS | INDEXES SHOW SCANS | QUERIES STAT NAMESPACE <ns> | INDEX <ns> <indexname> STAT SYSTEM JOB MANAGEMENT KILL_QUERY <transaction_id> KILL_SCAN <scan_id> USER ADMINISTRATION CREATE USER <user> PASSWORD <password> ROLE[S] <role1>,<role2>... pre-defined roles: read|read-write|read-write-udf|sys-admin|user-admin DROP USER <user> SET PASSWORD <password> [FOR <user>] GRANT ROLE[S] <role1>,<role2>... TO <user> REVOKE ROLE[S] <role1>,<role2>... FROM <user> CREATE ROLE <role> PRIVILEGE[S] <priv1[.ns1[.set1]]>,<priv2[.ns2[.set2]]>... priv: read|read-write|read-write-udf|sys-admin|user-admin ns: namespace. Applies to all namespaces if not set. set: set name. Applie to all sets within namespace if not set. sys-admin and user-admin can‘t be qualified with namespace or set. DROP ROLE <role> GRANT PRIVILEGE[S] <priv1[.ns1[.set1]]>,<priv2[.ns2[.set2]]>... TO <role> REVOKE PRIVILEGE[S] <priv1[.ns1[.set1]]>,<priv2[.ns2[.set2]]>... FROM <role> SHOW USER [<user>] SHOW USERS SHOW ROLE <role> SHOW ROLES SETTINGS TIMEOUT (time in ms, default: 1000 ms) RECORD_TTL (time in ms, default: 0 ms) VERBOSE (true | false, default false) ECHO (true | false, default false) FAIL_ON_CLUSTER_CHANGE (true | false, default true, policy applies to scans) OUTPUT (table | json, default table) LUA_USERPATH <path>, default : /opt/aerospike/usr/udf/lua LUA_SYSPATH <path>, default : /opt/aerospike/sys/udf/lua To get the value of a setting, run: aql> GET <setting> To set the value of a setting, run: aql> SET <setting> <value> OTHER RUN <filepath> HELP QUIT|EXIT|Q Aerospike Query Copyright 2013 Aerospike. All rights reserved.
添加一条记录:
aql> INSERT INTO test.set_fir (PK,uid,uname) VALUES (‘key‘,1,‘Aerospike‘) OK, 1 record affected.
查询:
aql> select * from test.set_fir +-----+-------------+ | uid | uname | +-----+-------------+ | 1 | "Aerospike" | +-----+-------------+ 1 row in set (0.048 secs)
删除set:test.demo11 中的数据:
aql> DELETE FROM test.set_fir WHERE PK = ‘key‘ OK, 1 record affected.
也可以:
[[email protected] bin]# asinfo -v "set-config:context=namespace;id=test;set=set_fir;set-delete=true;" ok
[[email protected] ~]# asinfo -v "set-config:context=namespace;id=test;set=demo11;set-delete=true;" ok
查询:
aql> select * from test.demo11 0 rows in set (0.068 secs)
时间: 2024-10-31 19:24:11