1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

GitBook: [master] 60 pages and 12 assets modified

This commit is contained in:
Ginger Collison
2021-03-15 14:08:37 +00:00
committed by gitbook-bot
parent 3429cc74ff
commit 0f1d9e01a8
59 changed files with 714 additions and 661 deletions

View File

@@ -0,0 +1,27 @@
# Getting Started
Getting started with JetStream is straightforward. While we speak of Jetstream as if it is a seperate component, it's actually a subsystem built into the NATS server that needs to be enabled.
## Command line
Enable JetStream by specifying the `-js` flag when starting the NATS server.
`$ nats-server -js`
## Configuration File
Enable JetStream through a configuration file. By default, the JetStream subsytem will store data in the /tmp directory. Here's a minimal file that will store data in a local "nats" directory, suitable for development and local testing.
`$ nats-server -c js.conf`
```text
# js.conf
jetstream {
store_dir=nats
}
```
Normally JetStream will be run in clustered mode and will replicate data, so the best place to store JetStream data would be locally on a fast SSD. One should specifically avoid NAS or NFS storage for JetStream.
See [Using Docker](using_docker.md) and [Using Source](using_source.md) for more information.

View File

@@ -1,26 +0,0 @@
# Getting Started
Getting started with JetStream is straightforward. While we speak of Jetstream as if it is a seperate component, it's actually a subsystem built into the NATS server that needs to be enabled.
## Command line
Enable JetStream by specifying the `-js` flag when starting the NATS server.
`$ nats-server -js`
## Configuration File
Enable JetStream through a configuration file. By default, the JetStream subsytem will store data in the /tmp directory. Here's a minimal file that will store data in a local "nats" directory, suitable for development and local testing.
`$ nats-server -c js.conf`
```text
# js.conf
jetstream {
store_dir=nats
}
```
Normally JetStream will be run in clustered mode and will replicate data, so the best place to store JetStream data would be locally on a fast SSD. One should specifically avoid NAS or NFS storage for JetStream.
See [Using Docker](./using_docker.md) and [Using Source](./using_source.md) for more information.

View File

@@ -0,0 +1,2 @@
# Using Docker with NGS

View File

@@ -4,13 +4,13 @@ The `natsio/nats-box:latest` docker image contains the `nats` utility this guide
In one window start a JetStream enabled nats server:
```
```text
$ docker run --network host -p 4222:4222 nats -js
```
And in another log into the utilities:
```
```text
$ docker run -ti --network host natsio/nats-box
```
@@ -18,22 +18,24 @@ This shell has the `nats` utility and all other NATS cli tools used in the rest
Now skip to the `Administer JetStream` section.
### Using Docker with NGS
## Using Docker with NGS
You can join a JetStream instance to your [NGS](https://synadia.com/ngs/pricing) account, first we need a credential for testing JetStream:
You'll want to do this outside of docker to keep the credentials that are generated.
```
```text
$ nsc add user -a YourAccount --name leafnode --expiry 1M
```
You'll get a credential file somewhere like `~/.nkeys/creds/synadia/YourAccount/leafnode.creds`, mount this file into the docker container for JetStream using `-v ~/.nkeys/creds/synadia/YourAccount/leafnode.creds:/leafnode.creds`.
```
```text
$ docker run -ti -v ~/.nkeys/creds/synadia/YourAccount/leafnode.creds:/leafnode.creds --name jetstream synadia/jsm:latest server
[1] 2020/01/20 12:44:11.752465 [INF] Starting nats-server version 2.2.0
...
[1] 2020/01/20 12:55:01.849033 [INF] Connected leafnode to "connect.ngs.global"
```
Your JSM shell will still connect locally, other connections in your NGS account can use JetStream at this point.
Your JSM shell will still connect locally, other connections in your NGS account can use JetStream at this point.

View File

@@ -1,10 +1,10 @@
# Using Source or a Binary
# 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.
```
```text
$ git clone https://github.com/nats-io/nats-server.git
$ cd nats-server
$ git checkout master
@@ -14,7 +14,7 @@ $ ls -l nats-server
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.
```
```text
$ ./nats-server -js
[16928] 2019/12/04 19:16:29.596968 [INF] Starting nats-server version 2.2.0
@@ -32,7 +32,7 @@ $ ./nats-server -js
You can override the storage directory if you want.
```
```text
$ ./nats-server -js -sd /tmp/test
[16943] 2019/12/04 19:20:00.874148 [INF] Starting nats-server version 2.2.0
@@ -50,7 +50,7 @@ $ ./nats-server -js -sd /tmp/test
These options can also be set in your configuration file:
```
```text
// enables jetstream, an empty block will enable and use defaults
jetstream {
// jetstream data will be in /data/nats-server/jetstream
@@ -62,4 +62,5 @@ jetstream {
// 10GB
max_file_store: 10737418240
}
```
```