mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-17 13:30:38 +00:00
7f8195861ea27d70c8ac61bf894c2140f45d7de6
* feat: Impl cmp_element() for Vector * chore: Add doc comments to MutableVector * feat: Add create_mutable() to DataType Add `create_mutable()` to create a MutableVector for each DataType. Implement ListVectorBuilder and NullVectorBuilder for ListType and NullType. * feat: Add ValueRef ValueRef is a reference to value, could be used to avoid some allocation when getting data from Vector. To support ValueRef, also implement a ListValueRef for ListValue, but comparision of ListValueRef still requires some allocation, due to the complexity of ListValue and ListVector. Impl some From trait for ValueRef * feat: Implement get_ref for Vector * feat: Remove cmp_element from Vector `cmp_element` could be replaced by `get_ref` and then compare * feat: Implement push/extend for PrimitiveVectorBuilder Implement push_value_ref() and extend_slice_of() for PrimitiveVectorBuilder. Also refactor the DataTypeBuilder trait for primitive types to PrimitiveElement trait, adds necessary cast helper methods to it. - Cast a reference to Vector to reference arrow's primitive array - Cast a ValueRef to primitive type - Also make PrimitiveElement super trait of Primitive * feat: Implement push/extend for all vector builders Implement push_value_ref() and extend_slice_of() for remaining vector builders. Add some helpful cast method to ValueRef and a method to cast Value to ValueRef. Change the behavior of PrimitiveElement::cast_xxx to panic when unable to cast, since push_value_ref() and extend_slice_of() always panic when given invalid input data type. * feat: MutableVector returns error if data type unmatch * test: Add tests for ValueRef * feat: Add tests for Vector::get_ref * feat: NullVector returns error if data type unmatch * test: Add tests for vector builders * fix: Fix compile error in python coprocessor * refactor: Add lifetime param to IntoValueRef The Primitive trait just use the `IntoValueRef<'static>` bound. Also rename create_mutable to create_mutable_vector. * chore: Address CR comments * feat: Customize PartialOrd/Ord for Value/ValueRef Panics if values/refs have different data type * style: Fix clippy * refactor: Use macro to generate body of ValueRef::as_xxx
GreptimeDB
GreptimeDB: the next-generation hybrid timeseries/analytics processing database in the cloud.
Getting Started
Prerequisites
To compile GreptimeDB from source, you'll need the following:
- Rust
- Protobuf
- OpenSSL
Rust
The easiest way to install Rust is to use rustup, which will check our rust-toolchain file and install correct Rust version for you.
Protobuf
protoc is required for compiling .proto files. protobuf is available from
major package manager on macos and linux distributions. You can find an
installation instructions here.
OpenSSL
For Ubuntu:
sudo apt install libssl-dev
For RedHat-based: Fedora, Oracle Linux, etc:
sudo dnf install openssl-devel
For macOS:
brew install openssl
Build the Docker Image
docker build --network host -f docker/Dockerfile -t greptimedb .
Usage
Start Datanode
// Start datanode with default options.
cargo run -- datanode start
OR
// Start datanode with `http-addr` option.
cargo run -- datanode start --http-addr=0.0.0.0:9999
OR
// Start datanode with `log-dir` and `log-level` options.
cargo run -- --log-dir=logs --log-level=debug datanode start
Start datanode with config file:
cargo run -- --log-dir=logs --log-level=debug datanode start -c ./config/datanode.example.toml
Start datanode by runing docker container:
docker run -p 3000:3000 \
-p 3001:3001 \
-p 3306:3306 \
greptimedb
SQL Operations
-
Connecting DB by mysql client:
# The datanode listen on port 3306 by default. mysql -h 127.0.0.1 -P 3306 -
Create table:
CREATE TABLE monitor ( host STRING, ts BIGINT, cpu DOUBLE DEFAULT 0, memory DOUBLE, TIME INDEX (ts), PRIMARY KEY(ts,host)) ENGINE=mito WITH(regions=1); -
Insert data:
INSERT INTO monitor(host, cpu, memory, ts) VALUES ('host1', 66.6, 1024, 1660897955); INSERT INTO monitor(host, cpu, memory, ts) VALUES ('host2', 77.7, 2048, 1660897956); INSERT INTO monitor(host, cpu, memory, ts) VALUES ('host3', 88.8, 4096, 1660897957); -
Query data:
mysql> SELECT * FROM monitor; +-------+------------+------+--------+ | host | ts | cpu | memory | +-------+------------+------+--------+ | host1 | 1660897955 | 66.6 | 1024 | | host2 | 1660897956 | 77.7 | 2048 | | host3 | 1660897957 | 88.8 | 4096 | +-------+------------+------+--------+ 3 rows in set (0.01 sec)You can delete your data by removing
/tmp/greptimedb.
Description
Open-source, cloud-native, unified observability database for metrics, logs and traces, supporting SQL/PromQL/Streaming.
analyticscloud-nativedatabasedistributedgreptimedblogsmetricsmonitoringobservabilityobservability-databaseobservability-datalakepromqlrustrust-databasesqltime-seriestracestsdb
Readme
Apache-2.0
853 MiB
Languages
Rust
99.6%