Cassandra

Cassandra 是最终一致的键值存储,类似于 HBase 和 Google 的 Bigtable。它实现了具有列族的分布式哈希图,最初它支持非常接近 HBase 的基于 Thrift 的 API。最近,Cassandra 转向了类似 SQL 的查询语言,在数据类型,联接和过滤器方面具有更大的灵 Active。值得庆幸的是,Thrift 接口仍然存在,因此可以轻松转换 OpenTSDB HBase 模式并通过 AsyncHBase HBaseClient API 在较低级别上调用 Cassandra。 AsyncCassandra是 OpenTSDB 和 Cassandra 之间的隔离程序,用于尝试使用备用后端进行 TSDB。

Setup

  • 使用ByteOrderedPartitioner设置 Cassandra 集群。这很关键,因为我们需要对行键进行排序。因为此设置会影响整个节点,所以您可能需要设置专用于 OpenTSDB 的集群。

  • 使用 cassandra-cli 脚本创建正确的键空间和列族:

create keyspace tsdb;
use tsdb;
create column family t with comparator = BytesType;

create keyspace tsdbuid;
use tsdbuid;
create column family id with comparator = BytesType;
create column family name with comparator = BytesType;
  • 通过执行 sh build-cassandra.sh 来构建 TSDB(或者,如果您更喜欢 Maven,则执行 sh build-cassandra.sh pom.xml)。

  • 使用 asynccassandra.seeds 参数修改您的 opentsdb.conf 文件,例如 asynccassandra.seeds = 127.0.0.1:9160.

  • 在配置文件中,设置 tsd.storage.hbase.uid_table = tsdbuid

  • 通过 build/tsdb tsd --config =<path> /opentsdb.conf 运行 tsd

如果打算使用元数据或树功能,请使用正确的表名重复键空间的创建。

Configuration

下表是带有必需参数和可选参数的表,用于在 Cassandra 中运行 OpenTSDB。这些是来自Configuration的标准 TSD 配置参数的补充

PropertyTypeRequiredDescriptionDefault
asynccassandra.seedsStringRequiredCassandra 群集中的节点列表。可以格式化\ :\
asynccassandra.portIntegerOptional如果未在种子设置中配置,则为所有节点使用的可选端口。9160