aql OPTIONS
可以通过aql --help来查看帮助文档,aql --help之后可以看到如下选项:
CREATE INDEX <index> ON <ns>[.<set>] (<bin>) <type>
NUMERIC
or
STRING
Value | Description |
---|---|
WO | 次级索引只写模式, 一般情况下只能进行更新次级索引,但不能进行查询 |
RW | 次级索引读写模式. 这种模式下可以进行查询 |
KILL_QUERY <id>
KILL_SCAN <id>
SELECT * FROM <ns>[.<set>]
select * from test.myset
SELECT <bin>[, <bin>[, ...]] FROM <ns>[.<set>]
select name, age from test.myset
SELECT <bin>[, <bin>[, ...]] FROM <ns>[.<set>] WHERE [<predicate>]
<bin> BETWEEN <lower> AND <upper>
<bin> = <value>
aql> CREATE INDEX user_age_idx ON test.myset (age) STRING
aql> CREATE INDEX user_age_idx ON test.myset (age)
NUMERIC
functionavg_age(stream)localfunctionfemale(rec)return rec.gender == "F"endlocalfunctionname_age(rec)return map{ name=rec.name, age=rec.age }
endlocalfunctioneldest(p1, p2)if p1.age > p2.age thenreturn p1
elsereturn p2
endendreturn stream : filter(female) : map(name_age) : reduce(eldest)
end
AGGREGATE <module>.<function>([<arg>[,...]]) ON <ns>[.<set>] WHERE <predicate>
aql> AGGREGATE profile_aggregator.avg_age() ON users.profiles WHERE age BETWEEN 20 and 29
+--------------------------------------+
+ avg_age |
+--------------------------------------+
+ { "name": "Annie Black", "age": 28 } |
+--------------------------------------+
INSERTINTO <ns>[.<set>] (PK, <bins>) VALUES (<key>, <values>)
DELETEFROM <ns>[.<set>] WHERE PK=<key>
aql> get <setting>
aql> get output
OUTPUT = TABLE
aql> set <setting> <value>
aql> set output json
输出模型.
VIEW ( TABLE | JSON )
例如
aql> set output table
启用详细输出
VERBOSE ( TRUE | FALSE )
Echo commands.
ECHO ( TRUE | FALSE )
查询过期时间,单位是毫秒
TIMEOUT <milliseconds>
以秒为单位的时间,随后创建或更新记录服务器将会在设置的这个时间内有效。
RECORD_TTL <seconds>
LUA_USERPATH <path>
Aerospike管理的lua文件路径
LUA_SYSPATH <path>
aql> stat system
+---------------------------------+--------------------+
| name | value |
+---------------------------------+--------------------+
| "cluster_size" | 1 |
| "cluster_key" | "AA47E9295DD25BC2" |
| "cluster_integrity" | "true" |
| "objects" | 12 |
...
179 rows in set (0.000 secs)
aql> stat index test numindex
+--------------------------+-------+
| name | value |
+--------------------------+-------+
| "keys" | 6 |
| "objects" | 11 |
| "data_memory_used" | 1320 |
| "load_pct" | 100 |
| "loadtime" | 6 |
| "stat_write_reqs" | 11 |
| "stat_write_success" | 11 |
| "stat_write_errs" | 0 |
| "stat_delete_reqs" | 0 |
| "stat_delete_success" | 0 |
| "stat_delete_errs" | 0 |
| "stat_defrag_recs" | 0 |
| "stat_defrag_time" | 0 |
| "n_query" | 6 |
| "avg_selectivity" | 2 |
| "avg_record_size" | 42 |
| "n_aggregation" | 5 |
| "agg_avg_selectivity" | 2 |
| "agg_avg_record_size" | 8 |
| "n_lookups" | 1 |
| "lookup_avg_selectivity" | 6 |
| "lookup_avg_record_size" | 106 |
+--------------------------+-------+
22 rows in set (0.000 secs)
aql> stat query
+--------------------------+-------+
| name | value |
+--------------------------+-------+
| "n_query_reqs" | 6 |
| "n_query_success" | 6 |
| "n_query_abort" | 0 |
| "n_query_fail" | 0 |
| "avg_selectivity" | 2 |
| "queue_full" | 0 |
| "n_aggregations" | 5 |
| "n_agg_success" | 5 |
| "n_agg_abort" | 0 |
| "avg_agg_selectivity" | 2 |
| "n_lookups" | 1 |
| "n_lookup_success" | 1 |
| "n_lookup_abort" | 0 |
| "avg_lookup_selectivity" | 6 |
+--------------------------+-------+
14 rows in set (0.000 secs)
REGISTER MODULE '<filepath>'
aql> register module '~/tmp/my_udf.lua'
aql> show modules
+---------------------------+-------+------------------------+
| module | type | hash |
+---------------------------+-------+------------------------+
| "example1.lua" | "lua" | "033671e05067888fce09" |
| "example2.lua" | "lua" | "07b42082cca8e73a96b2" |
+---------------------------+-------+------------------------+
2 rows in set (0.000 secs)
DESC MODULE <module>
aql> desc module example2.lua
+----------------------+-------+-------------------------+
| gen | type | content |
+----------------------+-------+-------------------------+
| "1t0IoVM2B/zwAb3QMa" | "LUA" | "CmxvY2FsIGZ1bmN0aW9uIG |
+----------------------+-------+-------------------------+
1 row in set (0.000 secs)
REMOVE MODULE <module>
aql> remove module example2.lua