Skip to content

Commit 192e348

Browse files
committed
docs: add documents for pre-built binaries
1 parent 3a2160e commit 192e348

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,69 @@
22

33
The CLI tool to manage clusters on StreamNative Cloud.
44

5-
## Build
5+
## How to install
6+
7+
### (Recommended) Use pre-built binaries
8+
9+
Currently the release only supports macOS 14 or later with arm64 architecture.
10+
11+
Take v0.1.0 for example:
12+
13+
```bash
14+
export VERSION=0.1.0
15+
curl -O -L https://github.com/BewareMyPower/snctl-cpp/releases/download/v$VERSION/snctl-cpp-macos-14-arm64.zip
16+
unzip -q snctl-cpp-macos-14-arm64.zip
17+
./install.sh
18+
```
19+
20+
The binary and configuration file will be installed under `~/.snctl-cpp`, so you have to add it to your `PATH`:
21+
22+
```bash
23+
export PATH=$HOME/.snctl-cpp:$PATH
24+
```
25+
26+
Now, you can run `snctl-cpp -h` to see the help message.
27+
28+
### Build from source
629

730
You must have a C++ compiler that supports C++17.
831

932
```bash
1033
git submodule update --init --recursive
1134
cmake -B build
1235
cmake --build build
36+
cp build/snctl-cpp .
1337
```
1438

15-
Then you can find the executable in `build/snctl-cpp`.
39+
You can run `./install.sh` to override the existing installation in `~/.snctl-cpp` directory, but you can also just run `./snctl-cpp` directly without installing it. The `sncloud.ini` file in the current working directory has higher priority than the one in `~/.snctl-cpp` directory.
1640

17-
## How to use
41+
## How to manage topics in the cluster that enables Kafka protocol
1842

1943
**Please make sure the `sncloud.ini` file is in the current working directory or `~/.snctl-cpp` directory if you don't specify the `--config` option.**
2044

2145
You only need to fill the following fields in `sncloud.ini`:
2246
- `bootstrap.servers`: the URL of the Kafka service, e.g. `pc-xxx:9093` on StreamNative cloud.
2347
- (optional) `token`: the token generated by the API key. It's allowed to be empty for quickly testing against a local Kafka cluster without any authentication.
2448

25-
Run `./build/snctl-cpp -h` to see the help message.
26-
2749
Options:
2850
- Add the `--config <config-file>` option to specify a different path of the INI config file.
2951
- Add a `--client-id` option to specify the client id of the underlying Kafka client. In Ursa, the client id carries the zone information, see [here](https://docs.streamnative.io/docs/config-kafka-client#eliminate-cross-az-networking-traffic).
3052

3153
### Create a topic
3254

3355
```bash
34-
$ ./build/snctl-cpp create tp0
56+
$ snctl-cpp create tp0
3557
Created topic "tp0" with 1 partition
36-
$ ./build/snctl-cpp create tp1 -p 5
58+
$ snctl-cpp create tp1 -p 5
3759
Created topic "tp1" with 5 partitions
3860
```
3961

4062
### Delete a topic
4163

4264
```bash
43-
$ ./build/snctl-cpp delete tp
65+
$ snctl-cpp delete tp
4466
Failed to delete topic "tp": Broker: Unknown topic or partition
45-
$ ./build/snctl-cpp delete tp0
67+
$ snctl-cpp delete tp0
4668
Deleted topic "tp0"
4769
```
4870

@@ -51,7 +73,7 @@ Deleted topic "tp0"
5173
Query the owner brokers for all partitions:
5274

5375
```bash
54-
$ ./build/snctl-cpp describe <topic>
76+
$ snctl-cpp describe <topic>
5577
Partition[0] leader: {"id": 816909419, url: "pb0-<xxx>:9093"}"
5678
Partition[1] leader: {"id": 101337027, url: "pb4-<xxx>:9093"}"
5779
...
@@ -61,7 +83,7 @@ Partition[15] leader: {"id": 644587507, url: "pb2-<xxx>:9093"}"
6183
Query the owner brokers for all partitions in a specific zone (`use1-az1` in this case):
6284
6385
```bash
64-
$ ./build/snctl-cpp --client-id zone_id=use1-az1 describe <topic>
86+
$ snctl-cpp --client-id zone_id=use1-az1 describe <topic>
6587
Partition[0] leader: {"id": 1868363245, url: "pb5-<xxx>:9093"}
6688
Partition[1] leader: {"id": 1868363245, url: "pb5-<xxx>:9093"}
6789
...
@@ -75,7 +97,7 @@ As you can see, when a client specifies `use1-az1` as its zone, only brokers in
7597
List all topics and print the number of partitions for each topic:
7698
7799
```bash
78-
$ ./build/snctl-cpp list
100+
$ snctl-cpp list
79101
topic count: 2
80102
[0] "my-topic-2" with 1 partition
81103
[1] "my-topic-1" with 10 partitions

0 commit comments

Comments
 (0)