Skip to content

Cassandra Reader

CassandraReader 插件实现了从 Cassandra 读取数据的能力。

配置

下面是配置一个从 Cassandra 读取数据到终端的例子

json
{
  "job": {
    "setting": {
      "speed": {
        "channel": 1,
        "bytes": -1
      }
    },
    "content": {
      "reader": {
        "name": "cassandrareader",
        "parameter": {
          "host": "localhost",
          "port": 9042,
          "useSSL": false,
          "keyspace": "test",
          "table": "addax_src",
          "column": [
            "textCol",
            "blobCol",
            "writetime(blobCol)",
            "boolCol",
            "smallintCol",
            "tinyintCol",
            "intCol",
            "bigintCol",
            "varintCol",
            "floatCol",
            "doubleCol",
            "decimalCol",
            "dateCol",
            "timeCol",
            "timeStampCol",
            "uuidCol",
            "inetCol",
            "durationCol",
            "listCol",
            "mapCol",
            "setCol",
            "tupleCol",
            "udtCol"
          ]
        }
      },
      "writer": {
        "name": "streamwriter",
        "parameter": {
          "print": true
        }
      }
    }
  }
}

参数说明

配置项是否必须数据类型默认值描述
hostlist连接的域名或 IP,多个节点之间用逗号分隔
portint9042端口
usernamestring用户名
passwordstring密码
useSSLbooleanfalse是否使用SSL连接
keyspacestring需要同步的表所在的 keyspace
tablestring所选取的需要同步的表
columnlist所配置的表中需要同步的列集合,其中的元素可以指定列的名称或 writetime(column_name),后一种形式会读取column_name列的时间戳而不是数据
wherestring数据筛选条件的 cql 表达式
allowFilteringboolean是否在服务端过滤数据,详细描述参考官方文档的相关描述
consistencyLevelstringLOCAL_QUORUM数据一致性级别, 可选 ONE, QUORUM, LOCAL_QUORUM, EACH_QUORUM, ALL, ANY, TWO, THREE, LOCAL_ONE

支持的数据类型

目前支持除 counterCustom 类型之外的所有类型。

下面列出类型转换列表:

Addax 内部类型Cassandra 数据类型
Longint, tinyint, smallint,varint,bigint,time,counter
Doublefloat, double, decimal
Stringascii,varchar, text,uuid,timeuuid,duration,list,map,set,tuple,udt,inet
Datedate, timestamp
Booleanbool
Bytesblob