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

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

Aerospike系列:4:简单的增删改查aql的相关文章

Aerospike系列:3:简单的增删改查aql

[[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 auth

JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(三):两个Viewmodel搞定增删改查

前言:之前博主分享过knockoutJS和BootstrapTable的一些基础用法,都是写基础应用,根本谈不上封装,仅仅是避免了html控件的取值和赋值,远远没有将MVVM的精妙展现出来.最近项目打算正式将ko用起来,于是乎对ko和bootstraptable做了一些封装,在此分享出来供园友们参考.封装思路参考博客园大神萧秦,如果园友们有更好的方法,欢迎讨论. KnockoutJS系列文章: JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一) JS组件

JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(二)

前言:上篇 JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一) 介绍了下knockout.js的一些基础用法,由于篇幅的关系,所以只能分成两篇,望见谅!昨天就觉得应该快点完成下篇,要不然有点标题党的感觉,思及此,博主心有不安,于是加班赶出了下篇.如果你也打算用ko去做项目,且看看吧! 一.效果预览 其实也没啥效果,就是简单的增删改查,重点还是在代码上面,使用ko能够大量节省界面DOM数据绑定的操作.下面是整个整个增删改查逻辑的js代码: 页面效果: 二.

Mybatis使用之简单的增删改查

Mybatis使用之简单的增删改查 一:简介 主要记录最简单的数据的增删改查.下一章会有各个操作详细一点的配置说明.以Author表为例(见上一博客).Author表没有关联任何其他表.也没有特殊字段. 二:映射规则 2.1.映射文件中的sql方法与对应的XxxMapper接口中的方法映射规则: a)映射文件的namespace的值是XxxMapper接口的全限定名.即包名+接口名称 b)映射文件中表示增删改查的标签(select.insert.delete.update)的id的值是接口中方法

EF5(6) 简单三层 增删改查

1:项目结构 2:每层添加对其他层的引用,这里我们把除了Web层之外的所有的层生成的文件都放到解决方案下的Library文件夹下,然后每个项目分别来引用里面的dll项目文件. 我们在Model项目上,右键属性->生成-> 在下面的输出里面,选择上一级的 Library文件夹 2.2 我们调整项目的生成顺序 ,在解决方案或者是任意项目上右键,选择 生成依赖项,调整各个项目的依赖,这样的目的就是调整项目的生成顺序. 注意,这里你选择依赖项,并没有给项目与项目之间增加了dll的引用,只是单纯的修改了

通过JDBC进行简单的增删改查

通过JDBC进行简单的增删改查(以MySQL为例) 目录 前言:什么是JDBC 一.准备工作(一):MySQL安装配置和基础学习 二.准备工作(二):下载数据库对应的jar包并导入 三.JDBC基本操作 (1)定义记录的类(可选) (2)连接的获取 (3)insert (4)update (5)select (6)delete 四.测试 五.代码分析 六.思考问题 前言:什么是JDBC 维基百科的简介: Java 数据库连接,(Java Database Connectivity,简称JDBC)

用CI框架向数据库中实现简单的增删改查

以下代码基于CodeIgniter_2.1.3版 用PHP向数据库中实现简单的增删改查(纯代码)请戳 http://www.cnblogs.com/corvoh/p/4641476.html CodeIgniter_2.1.3与PHP5.6的兼容问题请戳 http://www.cnblogs.com/corvoh/p/4649357.html 增: //insert//语法:$bool=$this->db->insert('表名',关联数组); $data=array( 'username'=

用PHP向数据库中实现简单的增删改查(纯代码,待完善)

<?php $con = mysql_connect("localhost:3306","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("test", $con); $result = mysql_query("SELECT * FROM user"); echo "

entity framework—简单的增删改查

应用程序对数据库执行CRUD时,通过entity framework方式,实际上是对DbContext的操作,DbContext是EF的入口,DbContext拿到对应的消息(CRUD)后,通过ORM中的Mapping来将对象O映射成数据库中的关系R. 下面就简单的实现一下利用entity framework实现简单的增删改查.首先要说明的是我已经建立了在解决方案中映射了数据库中表"Customer".所有的操作都是针对这张表. 1.增加 Customer customer = new