aerospike mysql_Aerospike系列:4:简单的增删改查aql

[root@localhost bin]# aql --help

Usage: aql OPTIONS

OPTIONS

-h

The hostname to the server connect to. Default: 127.0.0.1

-p

The port number of the server to connect to. Default: 3000

-U

User name used to authenticate with cluster. Default: none

-P[]

Password used to authenticate with cluster. Default: none

User will be prompted on command line if -P specified and no password is given.

-c

Execute the specified command.

-f

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

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

-S

Enable SLAP mode for queries. Default: disabled

-t

Number of batch threads for SLAP mode. Default: 10

-i

Number of iterations per thread for SLAP mode. Default: 10

-o (json | table)

Set the output mode. Default: table

-F

Set output file path. Default: /dev/null

-u

Path to User managed UDF modules.

Default: /opt/aerospike/usr/udf/lua

-s

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 ON [.] () NUMERIC|STRING

CREATE LIST/MAPKEYS/MAVALUES INDEX ON [.] () NUMERIC|STRING

DROP INDEX [.]

REPAIR INDEX ON [.]

is the namespace for the index.

is the set name for the 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 [.] (PK, ) VALUES (, )

DELETE FROM [.] WHERE PK =

is the namespace for the record.

is the set name for the record.

is the record's primary key.

is the record's primary key.

is a comma-separated list of bin names.

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 FROM [.]

SELECT FROM [.] WHERE =

SELECT FROM [.] WHERE BETWEEN AND

SELECT FROM [.] WHERE PK =

SELECT FROM [.] IN WHERE =

SELECT FROM [.] IN WHERE BETWEEN AND

is the namespace for the records to be queried.

is the set name for the record to be queried.

is the record's primary key.

is the name of a bin.

is the value of a bin.

is the type of a index user wants to query. (LIST/MAPKEYS/MAPVALUES)

can be either a wildcard (*) or a comma-separated list of bin names.

is the lower bound for a numeric range query.

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 ''

SHOW MODULES

REMOVE MODULE

DESC MODULE

is file path to the UDF module(in single quotes).

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 .() ON [.]

EXECUTE .() ON [.] WHERE PK =

AGGREGATE .() ON [.] WHERE =

AGGREGATE .() ON [.] WHERE BETWEEN AND

is UDF module containing the function to invoke.

is UDF to invoke.

is a comma-separated list of argument values for the UDF.

is the namespace for the records to be queried.

is the set name for the record to be queried.

is the record's primary key.

is the name of a bin.

is the value of a bin.

is the lower bound for a numeric range query.

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 | INDEX

STAT SYSTEM

JOB MANAGEMENT

KILL_QUERY

KILL_SCAN

USER ADMINISTRATION

CREATE USER PASSWORD ROLE[S] ,...

pre-defined roles: read|read-write|read-write-udf|sys-admin|user-admin

DROP USER

SET PASSWORD [FOR ]

GRANT ROLE[S] ,... TO

REVOKE ROLE[S] ,... FROM

CREATE ROLE PRIVILEGE[S] ,...

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

GRANT PRIVILEGE[S] ,... TO

REVOKE PRIVILEGE[S] ,... FROM

SHOW USER []

SHOW USERS

SHOW 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 , default : /opt/aerospike/usr/udf/lua

LUA_SYSPATH , default : /opt/aerospike/sys/udf/lua

To get the value of a setting, run:

aql> GET

To set the value of a setting, run:

aql> SET

OTHER

RUN

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.

也可以:

[root@localhost bin]# asinfo -v "set-config:context=namespace;id=test;set=set_fir;set-delete=true;"

ok

[root@localhost ~]# 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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值