Powered By GitBook
Using Source
You will also want to have installed from the nats.go repo the examples/tools such as nats-pub, nats-sub, nats-req and possibly nats-bench. One of the design goals of JetStream was to be native to core NATS, so even though we will most certainly add in syntactic sugar to clients to make them more appealing, for this tech preview we will be using plain old NATS.
You will need a copy of the nats-server source locally and will need to be in the jetstream branch.
1
$ git clone https://github.com/nats-io/nats-server.git
2
$ cd nats-server
3
$ git checkout master
4
$ go build
5
$ ls -l nats-server
Copied!
Starting the server you can use the -js flag. This will setup the server to reasonably use memory and disk. This is a sample run on my machine. JetStream will default to 1TB of disk and 75% of available memory for now.
1
$ ./nats-server -js
2
3
[16928] 2019/12/04 19:16:29.596968 [INF] Starting nats-server version 2.2.0
4
[16928] 2019/12/04 19:16:29.597056 [INF] Git commit [not set]
5
[16928] 2019/12/04 19:16:29.597072 [INF] Starting JetStream
6
[16928] 2019/12/04 19:16:29.597444 [INF] ----------- JETSTREAM (Beta) -----------
7
[16928] 2019/12/04 19:16:29.597451 [INF] Max Memory: 96.00 GB
8
[16928] 2019/12/04 19:16:29.597454 [INF] Max Storage: 1.00 TB
9
[16928] 2019/12/04 19:16:29.597461 [INF] Store Directory: "/var/folders/m0/k03vs55n2b54kdg7jm66g27h0000gn/T/jetstream"
10
[16928] 2019/12/04 19:16:29.597469 [INF] ----------------------------------------
11
[16928] 2019/12/04 19:16:29.597732 [INF] Listening for client connections on 0.0.0.0:4222
12
[16928] 2019/12/04 19:16:29.597738 [INF] Server id is NAJ5GKP5OBVISP5MW3BFAD447LMTIOAHFEWMH2XYWLL5STVGN3MJHTXQ
13
[16928] 2019/12/04 19:16:29.597742 [INF] Server is ready
Copied!
You can override the storage directory if you want.
1
$ ./nats-server -js -sd /tmp/test
2
3
[16943] 2019/12/04 19:20:00.874148 [INF] Starting nats-server version 2.2.0
4
[16943] 2019/12/04 19:20:00.874247 [INF] Git commit [not set]
5
[16943] 2019/12/04 19:20:00.874273 [INF] Starting JetStream
6
[16943] 2019/12/04 19:20:00.874605 [INF] ----------- JETSTREAM (Beta) -----------
7
[16943] 2019/12/04 19:20:00.874613 [INF] Max Memory: 96.00 GB
8
[16943] 2019/12/04 19:20:00.874615 [INF] Max Storage: 1.00 TB
9
[16943] 2019/12/04 19:20:00.874620 [INF] Store Directory: "/tmp/test/jetstream"
10
[16943] 2019/12/04 19:20:00.874625 [INF] ----------------------------------------
11
[16943] 2019/12/04 19:20:00.874868 [INF] Listening for client connections on 0.0.0.0:4222
12
[16943] 2019/12/04 19:20:00.874874 [INF] Server id is NCR6KDDGWUU2FXO23WAXFY66VQE6JNWVMA24ALF2MO5GKAYFIMQULKUO
13
[16943] 2019/12/04 19:20:00.874877 [INF] Server is ready
Copied!
These options can also be set in your configuration file:
1
// enables jetstream, an empty block will enable and use defaults
2
jetstream {
3
// jetstream data will be in /data/nats-server/jetstream
4
store_dir: "/data/nats-server"
5
6
// 1GB
7
max_memory_store: 1073741824
8
9
// 10GB
10
max_file_store: 10737418240
11
}
Copied!
Last modified 7mo ago
Export as PDF
Copy link