From fdae67b43e00779bf4a22968588ae9d828a994ec Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Mon, 14 Nov 2022 21:18:23 +0800 Subject: [PATCH] docs: Simplify code in readme (#488) * docs: simplify readme * docs: update content * docs: add start docker section * docs: add c/c++ toolchain description * docs: minor tweak * docs: minor tweak again * docs: address review comments --- README.md | 96 +++++++++++++++++++++++++------------------------------ 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 5a29cd9323..bc8ef66485 100644 --- a/README.md +++ b/README.md @@ -38,72 +38,53 @@ for years. Based on their best-practices, GreptimeDB is born to give you: - Widely adopted database protocols and APIs - Extensible table engine architecture for extensive workloads -## Getting Started +## Quick Start -### Prerequisite +### Build -To compile GreptimeDB from source, you'll need the following: -- Rust -- Protobuf +#### Build from Source -#### Rust +To compile GreptimeDB from source, you'll need: -The easiest way to install Rust is to use [`rustup`](https://rustup.rs/), which will check our `rust-toolchain` file and install correct Rust version for you. +- C/C++ Toolchain: provides basic tools for compiling and linking. This is + available as `build-essential` on ubuntu and similar name on other platforms. +- Rust: the easiest way to install Rust is to use + [`rustup`](https://rustup.rs/), 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](https://grpc.io/docs/protoc-installation/). -#### Protobuf +#### Build with Docker -`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](https://grpc.io/docs/protoc-installation/). - -### Build the Docker Image +A docker image with necessary dependencies is provided: ``` docker build --network host -f docker/Dockerfile -t greptimedb . ``` -## Usage +### Run -### Start in standalone mode +Start GreptimeDB from source code, 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 - +cargo run -- standalone start ``` -Start with config file: +Or if you built from docker: ``` -cargo run -- --log-dir=logs --log-level=debug standalone start -c ./config/standalone.example.toml +docker run -p 4002:4002 -v "$(pwd):/tmp/greptimedb" greptime/greptimedb standalone start ``` -Start datanode by running docker container: +For more startup options, greptimedb's **distributed mode** and information +about Kubernetes deployment, check our [docs](https://greptime.com/docs). -``` -docker run -p 3000:3000 \ --p 3001:3001 \ --p 3306:3306 \ -greptimedb -``` +### Connect -### SQL Operations - -1. Connecting DB by [mysql client](https://dev.mysql.com/downloads/mysql/): +1. Connect to GreptimeDB via standard [MySQL + client](https://dev.mysql.com/downloads/mysql/): ``` # The standalone instance listen on port 4002 by default. @@ -111,11 +92,11 @@ greptimedb ``` 2. Create a database; -```SQL -CREATE DATABASE hello_greptime; -``` + ```SQL + CREATE DATABASE hello_greptime; + ``` -2. Create table: +3. Create table: ```SQL CREATE TABLE hello_greptime.monitor ( @@ -127,7 +108,7 @@ CREATE DATABASE hello_greptime; PRIMARY KEY(host)) ENGINE=mito WITH(regions=1); ``` -3. Insert data: +4. Insert data: ```SQL INSERT INTO hello_greptime.monitor(host, cpu, memory, ts) VALUES ('host1', 66.6, 1024, 1660897955000); @@ -135,7 +116,7 @@ CREATE DATABASE hello_greptime; INSERT INTO hello_greptime.monitor(host, cpu, memory, ts) VALUES ('host3', 88.8, 4096, 1660897957000); ``` -4. Query data: +5. Query data: ```SQL mysql> SELECT * FROM hello_greptime.monitor; @@ -148,9 +129,20 @@ CREATE DATABASE hello_greptime; +-------+---------------------+------+--------+ 3 rows in set (0.01 sec) ``` - You can delete your data by removing `/tmp/greptimedb`. -# Community +You can always cleanup test database by removing `/tmp/greptimedb`. + +## Resources + +- [Pre-built Binaries](https://github.com/GreptimeTeam/greptimedb/releases): + downloadable pre-built binaries for Linux and MacOS +- [Docker Images](https://hub.docker.com/r/greptime/greptimedb): pre-built + Docker images +- [`gtctl`](https://github.com/GreptimeTeam/gtctl): the command-line tool for + Kubernetes deployment +- [GreptimeDB Java Client](https://github.com/GreptimeTeam/greptimedb-client-java) + +## Community The core team will be thrilled if you participate in any way you like. When you are stuck, try asking for help by filing an issue with a detailed description of what you were trying to do