by shigemk2

当面は技術的なことしか書かない

aqlのhelpからいろいろ確認してみる

こんな抜粋やっていいのかな??とか思いつつ、でもまあ必要なことだと思うので。

環境

  • Ubuntu 16.04
  • Aerospike Tools 3.9.1

aqlでできること

  • インデックスを貼る/削除する/確認する
  • レコードを作成する/削除する

できないこと

  • desc(それっぽいのがなかった)

aql helpの抜粋

aql> help
COMMANDS
    
    DDL
        CREATE INDEX <index> ON <ns>[.<set>] (<bin>) NUMERIC|STRING|GEO2DSPHERE
        CREATE LIST/MAPKEYS/MAPVALUES INDEX <index> ON <ns>[.<set>] (<bin>) NUMERIC|STRING|GEO2DSPHERE
        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|data-admin
            ns:   namespace.  Applies to all namespaces if not set.
            set:  set name.  Applie to all sets within namespace if not set.
                  sys-admin, user-admin and data-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)
        RECORD_TTL                    (time in sec, default: 0)
        RECORD_PRINT_METADATA         (true | false, default false)
        VERBOSE                       (true | false, default false)
        ECHO                          (true | false, default true)
        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
        USE_SMD                       (true | false, default false)
        REPLICA_ANY                   (true | false, default false)
        
        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