mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-05 21:02:58 +00:00
* refactor: dependency, from frontend depends on datanode to datanode depends on frontend * wip: start frontend in datanode * wip: migrate create database to frontend * wip: impl alter table * fix: CR comments * feat: add table id and region ids field to CreateExpr * chore: rebase develop * refactor: frontend catalog should set from datanode * feat: gRPC AddColumn request support add multi columns * wip: move create table and create-on-insertion to frontend * wip: error handling * fix: some unit tests * fix: all unit tests * chore: merge develop * feat: add create/alter-on-insertion to dist_insert/sql_dist_insert * fix: add region number/catalog/schema to InsertExpr * feat: add handle_create_table/handle_create_database... * fix: remove catalog from insert expr * fix: CR comments * fix: when running in standalone mode, mysql opts and postgres opts should pass to frontend so that auctually running service can change the port to listen on * refactor: add a standalone subcommand, move frontend start stuff to cmd package * chore: optimize create table failure logs * docs: change readme * docs: update readme
3.1 KiB
3.1 KiB
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
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.
Build the Docker Image
docker build --network host -f docker/Dockerfile -t greptimedb .
Usage
Start in standalone mode
// Start datanode and frontend with default options.
cargo run -- --log-level=debug standalone start
OR
// Start with `http-addr` option.
cargo run -- --log-level=debug standalone start --http-addr=0.0.0.0:9999
OR
// Start with `mysql-addr` option.
cargo run -- --log-level=debug standalone start --mysql-addr=0.0.0.0:9999
OR
// Start datanode with `log-dir` and `log-level` options.
cargo run -- --log-dir=logs --log-level=debug standalone start --mysql-addr=0.0.0.0:4102
Start with config file:
cargo run -- --log-dir=logs --log-level=debug standalone start -c ./config/standalone.example.toml
Start datanode by running docker container:
docker run -p 3000:3000 \
-p 3001:3001 \
-p 3306:3306 \
greptimedb
SQL Operations
-
Connecting DB by mysql client:
# The standalone instance listen on port 4002 by default. mysql -h 127.0.0.1 -P 4002 -
Create a database;
CREATE DATABASE hello_greptime;
-
Create table:
CREATE TABLE hello_greptime.monitor ( host STRING, ts TIMESTAMP, cpu DOUBLE DEFAULT 0, memory DOUBLE, TIME INDEX (ts), PRIMARY KEY(host)) ENGINE=mito WITH(regions=1); -
Insert data:
INSERT INTO hello_greptime.monitor(host, cpu, memory, ts) VALUES ('host1', 66.6, 1024, 1660897955000); INSERT INTO hello_greptime.monitor(host, cpu, memory, ts) VALUES ('host2', 77.7, 2048, 1660897956000); INSERT INTO hello_greptime.monitor(host, cpu, memory, ts) VALUES ('host3', 88.8, 4096, 1660897957000); -
Query data:
mysql> SELECT * FROM hello_greptime.monitor; +-------+---------------------+------+--------+ | host | ts | cpu | memory | +-------+---------------------+------+--------+ | host1 | 2022-08-19 08:32:35 | 66.6 | 1024 | | host2 | 2022-08-19 08:32:36 | 77.7 | 2048 | | host3 | 2022-08-19 08:32:37 | 88.8 | 4096 | +-------+---------------------+------+--------+ 3 rows in set (0.01 sec)You can delete your data by removing
/tmp/greptimedb.
Contributing
Please refer to contribution guidelines for more information.