|
12 | 12 | <img alt="screenshot" src="./docs/images/screenshot.png" width="800px">
|
13 | 13 | </p>
|
14 | 14 |
|
15 |
| -## Installation |
| 15 | +## Documentation |
16 | 16 |
|
17 |
| -### One-line Installation |
18 |
| - |
19 |
| -Download the binary using the following command: |
20 |
| - |
21 |
| -```console |
22 |
| -curl -fsSL https://raw.githubusercontent.com/greptimeteam/gtctl/develop/hack/install.sh | sh |
23 |
| -``` |
24 |
| - |
25 |
| -After downloading, the `gtctl` will be in the current directory. |
26 |
| - |
27 |
| -You also can install `gtctl` from the AWS-CN S3 bucket: |
28 |
| - |
29 |
| -```console |
30 |
| -curl -fsSL https://downloads.greptime.cn/releases/scripts/gtctl/install.sh | sh -s -- -s aws |
31 |
| -``` |
32 |
| - |
33 |
| -### Homebrew |
34 |
| - |
35 |
| -On macOS, `gtctl` is available via Homebrew: |
36 |
| - |
37 |
| -```console |
38 |
| -brew tap greptimeteam/greptime |
39 |
| -brew install gtctl |
40 |
| -``` |
41 |
| - |
42 |
| -### From Source |
43 |
| - |
44 |
| -If you already have the [Go](https://go.dev/doc/install) installed, you can run the `make` command under this project to build `gtctl`: |
45 |
| - |
46 |
| -```console |
47 |
| -make gtctl |
48 |
| -``` |
49 |
| - |
50 |
| -After building, the `gtctl` will be generated in `./bin/`. If you want to install `gtctl`, you can run the `install` command: |
51 |
| - |
52 |
| -```bash |
53 |
| -# The built gtctl will be installed in /usr/local/bin. |
54 |
| -make install |
55 |
| - |
56 |
| -# The built gtctl will be installed in your customed path. |
57 |
| -make install INSTALL_DIR=<your-path> |
58 |
| -``` |
59 |
| - |
60 |
| -### Enable gtctl autocompletion |
61 |
| - |
62 |
| -#### Bash |
63 |
| - |
64 |
| -The `gtctl` completion script for Bash can be generated with the command `gtctl completion bash`. Sourcing the completion script in your shell enables `gtctl` autocompletion. |
65 |
| - |
66 |
| -```console |
67 |
| -echo 'source <(gtctl completion bash)' >> ~/.bashrc |
68 |
| -``` |
69 |
| - |
70 |
| -#### Zsh |
71 |
| - |
72 |
| -The `gtctl` completion script for Zsh can be generated with the command `gtctl completion zsh`. Sourcing the completion script in your shell enables `gtctl` autocompletion. |
73 |
| - |
74 |
| -```console |
75 |
| -mkdir -p $ZSH/completions && gtctl completion zsh > $ZSH/completions/_gtctl |
76 |
| -``` |
77 |
| - |
78 |
| -#### Fish |
79 |
| - |
80 |
| -The `gtctl` completion script for Fish can be generated with the command `gtctl completion fish`. Sourcing the completion script in your shell enables `gtctl` autocompletion. |
81 |
| - |
82 |
| -```console |
83 |
| -gtctl completion fish | source |
84 |
| -``` |
85 |
| - |
86 |
| -## Getting Started |
87 |
| - |
88 |
| -### Playground |
89 |
| - |
90 |
| -The **fastest** way to experience the GreptimeDB cluster is to use the playground: |
91 |
| - |
92 |
| -```console |
93 |
| -gtctl playground |
94 |
| -``` |
95 |
| - |
96 |
| -The `playground` will deploy the minimal GreptimeDB cluster on your environment in bare-metal mode. |
97 |
| - |
98 |
| -### Deploy in Bare-Metal Environment |
99 |
| - |
100 |
| -You can deploy the GreptimeDB cluster on a bare-metal environment by the following simple command: |
101 |
| - |
102 |
| -```console |
103 |
| -gtctl cluster create mycluster --bare-metal |
104 |
| -``` |
105 |
| - |
106 |
| -It will create all the meta information on `${HOME}/.gtctl`. |
107 |
| - |
108 |
| -If you want to do more configurations, you can use the yaml format config file: |
109 |
| - |
110 |
| -```console |
111 |
| -gtctl cluster create mycluster --bare-metal --config <your-config-file> |
112 |
| -``` |
113 |
| - |
114 |
| -You can refer to the example [`cluster.yaml`](./examples/bare-metal/cluster.yaml) and [`cluster-with-local-artifacts.yaml`](./examples/bare-metal/cluster-with-local-artifacts.yaml). |
115 |
| - |
116 |
| -### Deploy in Kubernetes |
117 |
| - |
118 |
| -#### Prerequisites |
119 |
| - |
120 |
| -- **Kubernetes 1.18 or higher version is required.** |
121 |
| - |
122 |
| - You can use the [`kind`](https://kind.sigs.k8s.io/) to create your own Kubernetes cluster: |
123 |
| - |
124 |
| - ```console |
125 |
| - kind create cluster |
126 |
| - ``` |
127 |
| - |
128 |
| -#### Cluster Operations |
129 |
| - |
130 |
| -Create your own GreptimeDB cluster and etcd cluster: |
131 |
| - |
132 |
| -```console |
133 |
| -gtctl cluster create mycluster -n default |
134 |
| -``` |
135 |
| - |
136 |
| -If you want to use artifacts(charts and images) that are stored in the CN region, you can enable `--use-greptime-cn-artifacts`: |
137 |
| - |
138 |
| -```console |
139 |
| -gtctl cluster create mycluster -n default --use-greptime-cn-artifacts |
140 |
| -``` |
141 |
| - |
142 |
| -After creating, the whole GreptimeDB cluster will start in the `default` namespace: |
143 |
| - |
144 |
| -```console |
145 |
| -# Get the cluster. |
146 |
| -gtctl cluster get mycluster -n default |
147 |
| - |
148 |
| -# List all clusters. |
149 |
| -gtctl cluster list |
150 |
| -``` |
151 |
| - |
152 |
| -You can use the `kubectl port-forward` command to forward frontend requests: |
153 |
| - |
154 |
| -```console |
155 |
| -kubectl port-forward svc/mycluster-frontend 4002:4002 > connections.out & |
156 |
| -``` |
157 |
| - |
158 |
| -Use your `mysql` client to connect to your cluster: |
159 |
| - |
160 |
| -```console |
161 |
| -mysql -h 127.0.0.1 -P 4002 |
162 |
| -``` |
163 |
| - |
164 |
| -If you want to delete the cluster, you can: |
165 |
| - |
166 |
| -```console |
167 |
| -# Delete the cluster. |
168 |
| -gtctl cluster delete mycluster -n default |
169 |
| - |
170 |
| -# Delete the cluster, including etcd cluster. |
171 |
| -gtctl cluster delete mycluster -n default --tear-down-etcd |
172 |
| -``` |
173 |
| - |
174 |
| -#### Dry Run Mode |
175 |
| - |
176 |
| -`gtctl` provides `--dry-run` option in cluster creation. If a user executes the command with `--dry-run`, `gtctl` will output the manifests content without applying them: |
177 |
| - |
178 |
| -```console |
179 |
| -gtctl cluster create mycluster -n default --dry-run |
180 |
| -``` |
181 |
| - |
182 |
| -#### Experimental Feature |
183 |
| - |
184 |
| -You can use the following commands to scale (or down-scale) your cluster: |
185 |
| - |
186 |
| -```console |
187 |
| -# Scale datanode to 3 replicas. |
188 |
| -gtctl cluster scale <your-cluster> -n <your-cluster-namespace> -c datanode --replicas 3 |
189 |
| - |
190 |
| -# Scale frontend to 5 replicas. |
191 |
| -gtctl cluster scale <your-cluster> -n <your-cluster-namespace> -c frontend --replicas 5 |
192 |
| -``` |
193 |
| - |
194 |
| -## Development |
195 |
| - |
196 |
| -There are many useful tools provided through Makefile, you can simply run `make help` to get more information: |
197 |
| - |
198 |
| -- Compile the project |
199 |
| - |
200 |
| - ```console |
201 |
| - make |
202 |
| - ``` |
203 |
| - |
204 |
| - Then the `gtctl` will be generated in `./bin/`. |
205 |
| - |
206 |
| - |
207 |
| -- Run the unit test |
208 |
| - |
209 |
| - ```console |
210 |
| - make test |
211 |
| - ``` |
212 |
| - |
213 |
| -- Run the e2e test |
214 |
| - |
215 |
| - ```console |
216 |
| - make e2e |
217 |
| - ``` |
| 17 | +* [Quickstart](https://docs.greptime.com/user-guide/operations/gtctl) to install and use gtctl |
218 | 18 |
|
219 | 19 | ## License
|
220 | 20 |
|
|
0 commit comments