LICENSE Documentation

Official TypeScript developer resources and documentation for yihong0618/LICENSE. Verified technical context for AI.

0 stars TypeScript TypeScript 1 file ยท ~223,662 tokens
RAW Doc

1. Project Overview & Quickstart (yihong0618/LICENSE)

LICENSE

Open-source repository yihong0618/LICENSE

Repository Details

Note: High-volume repository documentation is actively indexed and synchronized by YakaAI.

2. Official Technical Reference & Guides (yihong0618/docs)

File: docs/greptimecloud/migrate-to-greptimecloud/migrate-from-influxdb.md


keywords: [migration, InfluxDB, GreptimeCloud, HTTP API, Telegraf, client libraries, data visualization]

import DocTemplate from '../../db-cloud-shared/migrate/migrate-from-influxdb.md'

Migrate from InfluxDB

Navigate to the GreptimeCloud console and click the Connection Information section under Manage Your Data.
You can find the GreptimeDB URL, database name, as well as the username and password associated with the token.

shell
curl -X POST 'https://<host>/v1/influxdb/api/v2/write?bucket=<db-name>' \
  -H 'authorization: token <greptime_user:greptimedb_password>' \
  -d 'census,location=klamath,scientist=anderson bees=23 1566086400000000000'
shell
curl 'https://<host>/v1/influxdb/write?db=<db-name>&u=<greptime_user>&p=<greptimedb_password>' \
  -d 'census,location=klamath,scientist=anderson bees=23 1566086400000000000'
toml
[[outputs.influxdb_v2]]
  urls = ["https://<host>/v1/influxdb"]
  token = "<greptime_user>:<greptimedb_password>"
  bucket = "<db-name>"
  ## Leave empty
  organization = ""
toml
[[outputs.influxdb]]
  urls = ["https://<host>/v1/influxdb"]
  database = "<db-name>"
  username = "<greptime_user>"
  password = "<greptimedb_password>"
js
'use strict'
/** @module write
**/

import { InfluxDB, Point } from '@influxdata/influxdb-client'

/** Environment variables **/
const url = 'https://<host>/v1/influxdb'
const token = '<greptime_user>:<greptimedb_password>'
const org = ''
const bucket = '<db-name>'

const influxDB = new InfluxDB({ url, token })
const writeApi = influxDB.getWriteApi(org, bucket)
writeApi.useDefaultTags({ region: 'west' })
const point1 = new Point('temperature')
  .tag('sensor_id', 'TLM01')
  .floatField('value', 24.0)
writeApi.writePoint(point1)
python
import influxdb_client
from influxdb_client.client.write_api import SYNCHRONOUS

bucket = "<db-name>"
org = ""
token = "<greptime_user>:<greptimedb_password>"
url="https://<host>/v1/influxdb"

client = influxdb_client.InfluxDBClient(
    url=url,
    token=token,
    org=org
)

# Write script
write_api = client.write_api(write_options=SYNCHRONOUS)

p = influxdb_client.Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
write_api.write(bucket=bucket, org=org, record=p)
go
bucket := "<db-name>"
org := ""
token := "<greptime_user>:<greptimedb_password>"
url := "https://<host>/v1/influxdb"
client := influxdb2.NewClient(url, token)
writeAPI := client.WriteAPIBlocking(org, bucket)

p := influxdb2.NewPoint("stat",
    map[string]string{"unit": "temperature"},
    map[string]interface{}{"avg": 24.5, "max": 45},
    time.Now())
writeAPI.WritePoint(context.Background(), p)
client.Close()
java
private static String url = "https://<host>/v1/influxdb";
private static String org = "";
private static String bucket = "<db-name>";
private static char[] token = "<greptime_user>:<greptimedb_password>".toCharArray();

public static void main(final String[] args) {

    InfluxDBClient influxDBClient = InfluxDBClientFactory.create(url, token, org, bucket);
    WriteApiBlocking writeApi = influxDBClient.getWriteApiBlocking();
    Point point = Point.measurement("temperature")
            .addTag("location", "west")
            .addField("value", 55D)
            .time(Instant.now().toEpochMilli(), WritePrecision.MS);

    writeApi.writePoint(point);
    influxDBClient.close();
}
php
$client = new Client([
    "url" => "https://<host>/v1/influxdb",
    "token" => "<greptime_user>:<greptimedb_password>",
    "bucket" => "<db-name>",
    "org" => "",
    "precision" => InfluxDB2\Model\WritePrecision::S
]);

$writeApi = $client->createWriteApi();

$dateTimeNow = new DateTime('NOW');
$point = Point::measurement("weather")
        ->addTag("location", "Denver")
        ->addField("temperature", rand(0, 20))
        ->time($dateTimeNow->getTimestamp());
$writeApi->write($point);

The GreptimeCloud console provides a Workbench for data visualization.
To use it, open the Greptime console, select Web Dashboard under Manage Your Data,
then create a new Workbench file and add panels as your needs.

shell
for file in data.*; do
  curl -i --retry 3 \
    -X POST "https://${GREPTIME_HOST}/v1/influxdb/write?db=${GREPTIME_DB}&u=${GREPTIME_USERNAME}&p=${GREPTIME_PASSWORD}" \
    --data-binary @${file}
  sleep 1
done

File: docs/greptimecloud/migrate-to-greptimecloud/migrate-from-prometheus.md


keywords: [migration, Prometheus, GreptimeCloud, remote write, PromQL, Grafana]

import DocTemplate from '../../db-cloud-shared/migrate/_migrate-from-prometheus.md'

Migrate from Prometheus

For information on configuring Prometheus to write data to GreptimeDB, please refer to the remote write documentation.

For detailed information on querying data in GreptimeDB using Prometheus query language, please refer to the HTTP API section in the PromQL documentation.

To add GreptimeDB as a Prometheus data source in Grafana, please refer to the Grafana documentation.


File: docs/greptimecloud/integrations/sdk-libraries/go.md


keywords: [Go SDK, gRPC, database connection, authentication, GreptimeCloud]

Go SDK

The GreptimeDB Go ingester library utilizes gRPC for writing data to the database. For how to use the library, please refer to the Go library documentation.

To connect to GreptimeCloud, using information below:

  • Host: <host>
  • Port: 5001
  • Database: <dbname>
  • Username: ``
  • Password: ``

The following code shows how to create a client.

go
cfg := greptime.NewConfig("<host>").
    WithDatabase("<dbname>").
    WithPort(5001).
    WithInsecure(false).
    WithAuth("<username>", "<password>")

cli, err := greptime.NewClient(cfg)
if err != nil {
    panic("failed to init client")
}

File: docs/greptimecloud/integrations/sdk-libraries/java.md


keywords: [Java SDK, gRPC, database connection, authentication]

Java SDK

The GreptimeDB Java ingester library utilizes gRPC for writing data to the database. For how to use the library, please refer to the Java library documentation.

To connect to GreptimeCloud, using information below:

  • Host: <host>
  • Port: 5001
  • Database: <dbname>
  • Username: ``
  • Password: ``

The following code snippet shows how to connect to database:

java
String database = "<dbname>";
String[] endpoints = {"<host>:5001"};
AuthInfo authInfo = new AuthInfo("<username>", "<password>");
GreptimeOptions opts = GreptimeOptions.newBuilder(endpoints, database)
        .authInfo(authInfo)
        .tlsOptions(new TlsOptions())
        .build();
GreptimeDB client = GreptimeDB.create(opts);

File: docs/greptimecloud/integrations/alloy.md


keywords: [Grafana Alloy, Prometheus Remote Write, OpenTelemetry, data pipeline]

Alloy

Grafana Alloy is an observability data pipeline as well as an OpenTelemetry
collector distribution. You can integrate your GreptimeCloud instance as data
sinks of Alloy.

Prometheus Remote Write

Configure GreptimeDB as remote write target.

text
// config.alloy

prometheus.remote_write "greptimedb" {
    endpoint {
        url = "https://<host>/v1/prometheus/write?db=<dbname>"

        basic_auth {
            username = "<username>"
            password = "<password>"
        }
    }
}

OpenTelemetry

GreptimeDB can also be configured as OpenTelemetry collector.

text
// config.alloy

otelcol.exporter.otlphttp "greptimedb" {
  client {
    endpoint = "https://<host>/v1/otlp/"
    headers  = {
      "X-Greptime-DB-Name" = "<dbname>",
    }
    auth     = otelcol.auth.basic.credentials.handler
  }
}

otelcol.auth.basic "credentials" {
  username = "<username>"
  password = "<password>"
}

File: docs/greptimecloud/integrations/dbeaver.md


keywords: [DBeaver, MySQL, database connection, database tool, GreptimeCloud]

DBeaver

DBeaver is a free, open-source, and cross-platform database tool that supports all popular databases. It is a popular choice among developers and database administrators for its ease of use and extensive feature set.

You can use DBeaver to connect to GreptimeDB via MySQL database drivers.
Click the "New Database Connection" button in the DBeaver toolbar to create a new connection to GreptimeDB.

Select MySQL and click "Next" to configure the connection settings.
Install the MySQL driver if you haven't already.
Input the following connection details:

  • Connect by Host
  • Host: <host>
  • Port: 4002
  • Database: <dbname>
  • Enter the and

Click "Test Connection" to verify the connection settings and click "Finish" to save the connection.

For more information on interacting with GreptimeDB using MySQL, refer to the MySQL protocol documentation.


File: docs/greptimecloud/integrations/emqx.md


keywords: [EMQX, MQTT, IoT, data ingestion, GreptimeCloud]

EMQX Platform

EMQX Platform is an MQTT Gateway, designed to handle
massive amounts of IoT device connections and message traffic, making it a
popular choice for building large-scale IoT applications. It has built-in
support for GreptimeDB as a data integration. By adding GreptimeDB as a Data
Persistent sink, you can ingest EMQX messages into GreptimeDB automatically.

You will need to follow these steps for your complete IoT data link, from MQTT
to database:

  • Sign up your account on EMQX Platform
  • Create a Dedicated Instance and wait for it's up and running
  • Setup Private Link or NAT Gateway for your deployment so it has internet
    access
  • Go to Data Integrations and find GreptimeDB
  • Configure your GreptimeDB connector using following information
    • Server host: <host>:4001
    • Database: <dbname>
    • Username: ``
    • Password: ``

Then you are all set. Start from using EMQX's debugging tools to generate data
and check GreptimeDB Dashboard for the data ingested.


File: docs/greptimecloud/integrations/fluent-bit.md


keywords: [Fluent Bit, GreptimeCloud, metrics ingestion, logs ingestion, data pipeline]

Fluent Bit

Fluent Bit is a lightweight and fast log processor and forwarder that can collect, parse, filter, and forward logs and metrics. Fluent Bit is part of the Fluentd project ecosystem and is written in C language. It is designed to be memory-efficient and performant, making it suitable for use in resource-constrained environments.

HTTP

Fluent Bit can be configured to send logs to GreptimeCloud using the HTTP protocol. This allows you to collect logs from various sources and send them to GreptimeCloud for storage, analysis, and visualization.

text
[OUTPUT]
    Name             http
    Match            *
    Host             <host>
    Port             443
    Uri              /v1/events/logs?db=<dbname>&table=<table_name>&pipeline_name=<pipeline_name>
    Format           json
    Json_date_key    scrape_timestamp
    Json_date_format iso8601
    Tls              On
    compress         gzip
    http_User        <username>
    http_Passwd      <password>

In this example, the http output plugin is used to send logs to GreptimeCloud. For more information, and extra options, refer to the Logs HTTP API guide.

Prometheus Remote Write

Fluent Bit can be configured to send metrics to GreptimeCloud using the Prometheus Remote Write protocol. This allows you to collect metrics from various sources and send them to GreptimeCloud for storage, analysis, and visualization.

text
[OUTPUT]
    Name                 prometheus_remote_write
    Match                internal_metrics
    Host                 <host>
    Port                 443
    Uri                  /v1/prometheus/write?db=<dbname>
    Tls                  On
    http_user            <username>
    http_passwd          <password>

In this example, the prometheus_remote_write output plugin is used to send metrics to GreptimeCloud. For more information, and extra options, refer to the Prometheus Remote Write guide.

OpenTelemetry

Fluent Bit can be configured to send logs and metrics to GreptimeCloud using the OpenTelemetry protocol. This allows you to collect logs and metrics from various sources and send them to GreptimeCloud for storage, analysis, and visualization.

text
# Only for metrics
[OUTPUT]
    Name                 opentelemetry
    Alias                opentelemetry_metrics
    Match                *_metrics
    Host                 <host>
    Port                 443
    Metrics_uri          /v1/otlp/v1/metrics
    http_User            <username>
    http_Passwd          <password>
    Log_response_payload True
    Tls                  On
    compress             gzip

# Only for logs
[OUTPUT]
    Name                 opentelemetry
    Alias                opentelemetry_logs
    Match                *_logs
    Host                 <host>
    Port                 443
    Logs_uri             /v1/otlp/v1/logs
    http_User            <username>
    http_Passwd          <password>
    Log_response_payload True
    Tls                  On
    compress             gzip
    Header X-Greptime-Log-Table-Name "<log_table_name>"
    Header X-Greptime-Log-Pipeline-Name "<pipeline_name>"
    Header X-Greptime-DB-Name "<dbname>"

In this example, the OpenTelemetry OTLP/HTTP API interface is used. For more information, and extra options, refer to the OpenTelemetry guide.


File: docs/greptimecloud/integrations/grafana.md


keywords: [Grafana, data source, Prometheus, MySQL, GreptimeCloud]

Grafana

GreptimeDB can be configured as a Grafana data source.
You have the option to connect GreptimeDB with Grafana using one of three data sources: GreptimeDB, Prometheus, or MySQL.

GreptimeDB data source plugin

Before using the GreptimeDB data source, it is necessary to manually install the GreptimeDB data source plugin.
For more information,
please refer to the GreptimeDB data source plugin document.

Click the Add data source button and select GreptimeDB as the type. Fill in the following URL in the GreptimeDB server URL:

txt
https://<host>

Then do the following configuration:

  • Database Name:<dbname>, leave it blank to use the default database public
  • In the Auth section, click basic auth, and fill in the username and password for GreptimeDB in the Basic Auth Details section (not set by default, no need to fill in).
    • User: ``
    • Password: ``

Then click the Save & Test button to test the connection.

Prometheus data source

Click the Add data source button and select Prometheus as the type.

Fill in Prometheus server URL in HTTP:

txt
https://<host>/v1/prometheus

Click basic auth in the Auth section and fill in your GreptimeDB username and password in Basic Auth Details:

  • User: ``
  • Password: ``

Click Custom HTTP Headers and add one header:

  • Header: x-greptime-db-name
  • Value: <dbname>

Then click Save & Test button to test the connection.

MySQL data source

Click the Add data source button and select MySQL as the type. Fill in the following information in MySQL Connection:

  • Host: <host>:4002
  • Database: <dbname>
  • User: ``
  • Password: ``
  • Session timezone: UTC

Then click Save & Test button to test the connection.

Note that you need to use raw SQL editor for panel creation. SQL Builder is not
supported due to timestamp data type difference between GreptimeDB and vanilla
MySQL.


File: docs/greptimecloud/integrations/influxdb.md


keywords: [InfluxDB, Telegraf, line protocol, data ingestion, API]

InfluxDB and Telegraf

GreptimeCloud provides Influxdb line
protocol

ingestion API over http. The API and authentication is compatible with InfluxDB
write protocol
1.x
.
Please refer to InfluxDB line protocol of GreptimeDB for more information.

  • URL: https://<host>/v1/influxdb/write?db=<dbname>
  • Username: ``
  • Password: ``

Telegraf

To use Telegraf to ingest data, add following configuration.

text
[[outputs.influxdb_v2]]
  urls = ["https://<host>/v1/influxdb"]
  token = "<username>:<password>"
  bucket = "<dbname>"
  ## Leave empty
  organization = ""

InfluxDB Client Library

The following Java example code demonstrates how to configure the InfluxDB
client
when connecting to
GreptimeCloud:

java
final String serverURL = "https://<host>/v1/influxdb/", username = "<username>", password = "<password>";
final InfluxDB influxDB = InfluxDBFactory.connect(serverURL, username, password);
influxDB.setDatabase("<dbname>");

File: docs/greptimecloud/integrations/kafka.md


keywords: [Kafka, Vector, logs, metrics, data ingestion]

Kafka

If you are using Kafka or Kafka-compatible message queue for observability data
transporting, it's possible to ingest data into GreptimeDB directly.

Here we are using Vector as the tool to transport data from Kafka to GreptimeDB.

Logs

A sample configuration. Note that you will need to create your
pipeline
for log
parsing.

toml
# sample.toml

[sources.log_mq]
type = "kafka"
group_id = "vector0"
topics = ["test_log_topic"]
bootstrap_servers = "kafka:9092"

[sinks.sink_greptime_logs]
type = "greptimedb_logs"
inputs = [ "log_mq" ]
compression = "gzip"
endpoint = "https://<host>"
dbname = "<dbname>"
username = "<username>"
password = "<password>"
compression = "gzip"
## customize to your own table and pipeline name
table = "demo_logs"
pipeline_name = "demo_pipeline"

Metrics

If you are using Kafka to transport metrics data in InfluxDB line protocol
format, you can also ingest it directly.

toml
# sample.toml

[sources.metrics_mq]
type = "kafka"
group_id = "vector0"
topics = ["test_metric_topic"]
bootstrap_servers = "kafka:9092"
decoding.codec = "influxdb"

[sinks.metrics_in]
inputs = ["metrics_mq"]
type = "greptimedb"
endpoint = "<host>:5001"
dbname = "<dbname>"
username = "<username>"
password = "<password>"
tls = {}

Reference

For detailed information on the data ingestion process, please refer to the Ingest Data via Kafka guide.


File: docs/greptimecloud/integrations/metabase.md


keywords: [Metabase, data source, community driver, configuration, BI tool]

Metabase

Metabase is an open source BI tool that
written in Clojure. You can configure GreptimeDB as a metabase data source from
a community driver plugin.

See our docs for
the instructions of plugin installation.

Connection information

  • Database type: GreptimeDB
  • Host: <host>
  • Port: 4003
  • Database name: <dbname>
  • User: ``
  • Password: ``