Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[中文](./README_CN.md)

## Introduction
CeresDBxClient is a high-performance Java client for CeresDB.
CeresDBClient is a high-performance Java client for CeresDB.
CeresDB is a high-performance, distributed, schema-less, cloud native time-series database that can handle both time-series and analytics workloads.

## Features
Expand All @@ -19,7 +19,7 @@ CeresDB is a high-performance, distributed, schema-less, cloud native time-serie

```
┌─────────────────────┐
CeresDBxClient
CeresDBClient
└─────────────────────┘
Expand Down Expand Up @@ -51,14 +51,14 @@ CeresDB is a high-performance, distributed, schema-less, cloud native time-serie
│ │
▼ ▼ ▼
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
CeresDBx Node1 │ │ CeresDBx Node2 │ │ ... │
CeresDB Node1 │ │ CeresDB Node2 │ │ ... │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
```

## Data query process
```
┌─────────────────────┐
CeresDBxClient
CeresDBClient
└─────────────────────┘
Expand Down Expand Up @@ -90,7 +90,7 @@ CeresDB is a high-performance, distributed, schema-less, cloud native time-serie
│ │
▼ ▼ ▼
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
CeresDBx Node1 │ │ CeresDBx Node2 │ │ ... │
CeresDB Node1 │ │ CeresDB Node2 │ │ ... │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
```

Expand All @@ -100,9 +100,9 @@ CeresDB is a high-performance, distributed, schema-less, cloud native time-serie

## Init CeresDB client
```java
// CeresDBx options
final CeresDBxOptions opts = CeresDBxOptions.newBuilder("127.0.0.1", 8831) //
.tenant("test", "sub_test", "test_token") // tenant info
// CeresDB options
final CeresDBOptions opts = CeresDBOptions.newBuilder("127.0.0.1", 8831) //// CeresDB default grpc port 8831
.tenant("public", "sub_test", "test_token") // tenant info
// maximum retry times when write fails
// (only some error codes will be retried, such as the routing table failure)
.writeMaxRetries(1)
Expand All @@ -111,9 +111,9 @@ final CeresDBxOptions opts = CeresDBxOptions.newBuilder("127.0.0.1", 8831) //
.readMaxRetries(1)
.build();

final CeresDBxClient client = new CeresDBxClient();
final CeresDBClient client = new CeresDBClient();
if (!client.init(this.opts)) {
throw new IllegalStateException("Fail to start CeresDBxClient");
throw new IllegalStateException("Fail to start CeresDBClient");
}
```
For more configuration options, see [configuration](docs/configuration.md)
Expand Down
22 changes: 11 additions & 11 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)

## 介绍
CeresDBxClient 是 CeresDB 的高性能 Java 版客户端。CeresDB 是定位为高性能的、分布式的、Schema-less 的云原生时序数据库。它可以同时支持时间序列和数据分析型的工作负载。
CeresDBClient 是 CeresDB 的高性能 Java 版客户端。CeresDB 是定位为高性能的、分布式的、Schema-less 的云原生时序数据库。它可以同时支持时间序列和数据分析型的工作负载。

## 功能特性
- 通信层基于 SPI 可扩展,默认提供 gRPC 的实现
Expand All @@ -16,7 +16,7 @@ CeresDBxClient 是 CeresDB 的高性能 Java 版客户端。CeresDB 是定位为

```
┌─────────────────────┐
CeresDBxClient
CeresDBClient
└─────────────────────┘
Expand Down Expand Up @@ -48,14 +48,14 @@ CeresDBxClient 是 CeresDB 的高性能 Java 版客户端。CeresDB 是定位为
│ │
▼ ▼ ▼
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
CeresDBx Node1 │ │ CeresDBx Node2 │ │ ... │
CeresDB Node1 │ │ CeresDB Node2 │ │ ... │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
```

## 查询流程
```
┌─────────────────────┐
CeresDBxClient
CeresDBClient
└─────────────────────┘
Expand Down Expand Up @@ -87,7 +87,7 @@ CeresDBxClient 是 CeresDB 的高性能 Java 版客户端。CeresDB 是定位为
│ │
▼ ▼ ▼
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
CeresDBx Node1 │ │ CeresDBx Node2 │ │ ... │
CeresDB Node1 │ │ CeresDB Node2 │ │ ... │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
```

Expand All @@ -96,8 +96,8 @@ CeresDBxClient 是 CeresDB 的高性能 Java 版客户端。CeresDB 是定位为

## 初始化 CeresDB Client
```java
// CeresDBx options
final CeresDBxOptions opts = CeresDBxOptions.newBuilder("127.0.0.1", 8831) //
// CeresDB options
final CeresDBOptions opts = CeresDBOptions.newBuilder("127.0.0.1", 8831) //
.tenant("test", "sub_test", "test_token") // tenant info
// maximum retry times when write fails
// (only some error codes will be retried, such as the routing table failure)
Expand All @@ -107,9 +107,9 @@ final CeresDBxOptions opts = CeresDBxOptions.newBuilder("127.0.0.1", 8831) //
.readMaxRetries(1)
.build();

final CeresDBxClient client = new CeresDBxClient();
final CeresDBClient client = new CeresDBClient();
if (!client.init(this.opts)) {
throw new IllegalStateException("Fail to start CeresDBxClient");
throw new IllegalStateException("Fail to start CeresDBClient");
}
```
配置详情见 [configuration](docs/configuration.md)
Expand All @@ -122,9 +122,9 @@ CeresDB 是一个 Schema-less 的时序数据引擎,你可以不必创建 sche
下面的建表语句(使用 SDK 的 SQL API)包含了 CeresDB 支持的所有字段类型:

```java
final CeresDBxOptions opts = CeresDBxOptions.newBuilder("127.0.0.1", 8831) // 默认 gprc 端口号
final CeresDBOptions opts = CeresDBOptions.newBuilder("127.0.0.1", 8831) // 默认 gprc 端口号
.managementAddress("127.0.0.1", 5440) // 注意,直接使用 sql 需要连接 CeresDB 的 http 端口
.tenant("test", "sub_test", "test_token") // 租户信息
.tenant("public", "sub_test", "test_token") // 租户信息
.writeMaxRetries(1) // 写入失败重试次数上限(只有部分错误 code 才会重试,比如路由表失效)
.readMaxRetries(1) // 查询失败重试次数上限(只有部分错误 code 才会重试,比如路由表失效)
.build();
Expand Down
22 changes: 11 additions & 11 deletions ceresdb-common/src/main/java/com/ceresdb/common/OptKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
public final class OptKeys {

public static final String OS_NAME = "os.name";
public static final String RW_LOGGING = "CeresDBx.client.read.write.rw_logging";
public static final String COLLECT_WROTE_DETAIL = "CeresDBx.client.write.collect_wrote_detail";
public static final String USE_OS_SIGNAL = "CeresDBx.client.use_os_signal";
public static final String REPORT_PERIOD = "CeresDBx.reporter.period_minutes";
public static final String SIG_OUT_DIR = "CeresDBx.signal.out_dir";
public static final String HTTP_READ_TIMEOUT_MS = "CeresDBx.http.read_timeout_ms";
public static final String HTTP_WRITE_TIMEOUT_MS = "CeresDBx.http.write_timeout_ms";
public static final String GRPC_CONN_RESET_THRESHOLD = "CeresDBx.grpc.conn.failures.reset_threshold";
public static final String AVAILABLE_CPUS = "CeresDBx.available_cpus";
public static final String NAME_VALIDATE = "CeresDBx.avro.name_validate";
public static final String WRITE_LIMIT_PERCENT = "CeresDBx.rpc.write.limit_percent";
public static final String RW_LOGGING = "CeresDB.client.read.write.rw_logging";
public static final String COLLECT_WROTE_DETAIL = "CeresDB.client.write.collect_wrote_detail";
public static final String USE_OS_SIGNAL = "CeresDB.client.use_os_signal";
public static final String REPORT_PERIOD = "CeresDB.reporter.period_minutes";
public static final String SIG_OUT_DIR = "CeresDB.signal.out_dir";
public static final String HTTP_READ_TIMEOUT_MS = "CeresDB.http.read_timeout_ms";
public static final String HTTP_WRITE_TIMEOUT_MS = "CeresDB.http.write_timeout_ms";
public static final String GRPC_CONN_RESET_THRESHOLD = "CeresDB.grpc.conn.failures.reset_threshold";
public static final String AVAILABLE_CPUS = "CeresDB.available_cpus";
public static final String NAME_VALIDATE = "CeresDB.avro.name_validate";
public static final String WRITE_LIMIT_PERCENT = "CeresDB.rpc.write.limit_percent";

private OptKeys() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
*/
public class AuthUtil {

public static final String HEAD_TIMESTAMP = "x-ceresdbx-timestamp";
public static final String HEAD_ACCESS_TENANT = "x-ceresdbx-access-tenant";
public static final String HEAD_ACCESS_TOKEN = "x-ceresdbx-access-token";
public static final String HEAD_ACCESS_CHILD_TENANT = "x-ceresdbx-access-child-tenant";
public static final String HEAD_TIMESTAMP = "x-ceresdb-timestamp";
public static final String HEAD_ACCESS_TENANT = "x-ceresdb-access-tenant";
public static final String HEAD_ACCESS_TOKEN = "x-ceresdb-access-token";
public static final String HEAD_ACCESS_CHILD_TENANT = "x-ceresdb-access-child-tenant";

public static Map<String, String> authHeaders(final Tenant tenant) {
if (tenant == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Cpus {
/**
* The configured number of available processors. The default is
* {@link Runtime#availableProcessors()}. This can be overridden
* by setting the system property "CeresDBx.available_cpus".
* by setting the system property "CeresDB.available_cpus".
*
* @return available cpus num
*/
Expand Down
14 changes: 7 additions & 7 deletions ceresdb-example/src/test/java/com/ceresdb/CeresDBTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import com.ceresdb.models.SqlResult;
import com.ceresdb.models.TagValue;
import com.ceresdb.models.WriteOk;
import com.ceresdb.options.CeresDBxOptions;
import com.ceresdb.options.CeresDBOptions;
import com.ceresdb.rpc.RpcOptions;

/**
Expand All @@ -64,8 +64,8 @@ public class CeresDBTest {

private String TEST_TABLE_NAME = "all_type_test_table_%d";

private CeresDBxOptions opts;
private CeresDBxClient client;
private CeresDBOptions opts;
private CeresDBClient client;

@Before
public void before() {
Expand All @@ -74,13 +74,13 @@ public void before() {
rpcOpts.setInitialLimit(32);
rpcOpts.setLimitKind(RpcOptions.LimitKind.Gradient);
rpcOpts.setLogOnLimitChange(true);
this.opts = CeresDBxOptions.newBuilder("127.0.0.1", 8831, 5000) //
this.opts = CeresDBOptions.newBuilder("127.0.0.1", 8831, 5000) //
.tenant("public", "sub_test", "test_token") //
.rpcOptions(rpcOpts) //
.writeMaxRetries(0) //
.readMaxRetries(1) //
.build();
this.client = new CeresDBxClient();
this.client = new CeresDBClient();
final boolean ret = this.client.init(this.opts);

TEST_TABLE_NAME = String.format(TEST_TABLE_NAME, System.currentTimeMillis());
Expand Down Expand Up @@ -111,7 +111,7 @@ public void before() {
"TIMESTAMP KEY(ts)) ENGINE=Analytic WITH (ttl='7d')",
TEST_TABLE_NAME));

LOG.info("Start CeresDBx client {}, with options: {}, create table {}: {}.", result(ret), this.opts,
LOG.info("Start CeresDB client {}, with options: {}, create table {}: {}.", result(ret), this.opts,
TEST_TABLE_NAME, result);

final SqlResult existsResult2 = management.executeSql("EXISTS TABLE %s", TEST_TABLE_NAME);
Expand All @@ -130,7 +130,7 @@ public void after() {
this.client.shutdownGracefully();
}

public CeresDBxOptions getOpts() {
public CeresDBOptions getOpts() {
return opts;
}

Expand Down
12 changes: 6 additions & 6 deletions ceresdb-example/src/test/java/com/ceresdb/ReadmeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.ceresdb;

import com.ceresdb.models.*;
import com.ceresdb.options.CeresDBxOptions;
import com.ceresdb.options.CeresDBOptions;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
Expand All @@ -35,19 +35,19 @@ public class ReadmeTest {
@Ignore
@Test
public void readmeTest() throws ExecutionException, InterruptedException {
final CeresDBxOptions opts = CeresDBxOptions.newBuilder("127.0.0.1", 8831) // CeresDB default grpc port 8831
.managementAddress("127.0.0.1", 5440) // CeresDB default http port 3307
.tenant("test", "sub_test", "test_token") // tenant info
final CeresDBOptions opts = CeresDBOptions.newBuilder("127.0.0.1", 8831) // CeresDB default grpc port 8831
.managementAddress("127.0.0.1", 5000) // CeresDB default http port 3307
.tenant("public", "sub_test", "test_token") // tenant info
// maximum retry times when write fails
// (only some error codes will be retried, such as the routing table failure)
.writeMaxRetries(1)
// maximum retry times when read fails
// (only some error codes will be retried, such as the routing table failure)
.readMaxRetries(1).build();

final CeresDBxClient client = new CeresDBxClient();
final CeresDBClient client = new CeresDBClient();
if (!client.init(opts)) {
throw new IllegalStateException("Fail to start CeresDBxClient");
throw new IllegalStateException("Fail to start CeresDBClient");
}

// Create table manually, creating table schema ahead of data ingestion is not required
Expand Down
4 changes: 2 additions & 2 deletions ceresdb-example/src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n"/>
</Console>

<!-- <RollingFile name="RollingFile" filename="log/CeresDBxClient.log"-->
<!-- filepattern="log/%d{YYYYMMddHHmmss}-CeresDBxClient.log">-->
<!-- <RollingFile name="RollingFile" filename="log/CeresDBClient.log"-->
<!-- filepattern="log/%d{YYYYMMddHHmmss}-CeresDBClient.log">-->
<!-- <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n"/>-->
<!-- <Policies>-->
<!-- <SizeBasedTriggeringPolicy size="100 MB"/>-->
Expand Down
Loading