mirror of
https://github.com/taigrr/nats.docs
synced 2025-01-18 04:03:23 -08:00
Update docker-compose doc (#126)
This commit is contained in:
parent
ad541650ec
commit
4eeb91f35d
@ -103,29 +103,33 @@ curl http://127.0.0.1:8222/routez
|
|||||||
It is also straightforward to create a cluster using Docker Compose. Below is a simple example that uses a network named `nats` to create a full mesh cluster.
|
It is also straightforward to create a cluster using Docker Compose. Below is a simple example that uses a network named `nats` to create a full mesh cluster.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
version: "3.5"
|
||||||
services:
|
services:
|
||||||
nats:
|
nats:
|
||||||
image: nats
|
image: nats
|
||||||
ports:
|
ports:
|
||||||
- "8222:8222"
|
- "8222:8222"
|
||||||
|
networks: ["nats"]
|
||||||
nats-1:
|
nats-1:
|
||||||
image: nats
|
image: nats
|
||||||
command: "--cluster nats://0.0.0.0:6222 --routes=nats://ruser:T0pS3cr3t@nats:6222"
|
command: "--cluster nats://0.0.0.0:6222 --routes=nats://ruser:T0pS3cr3t@nats:6222"
|
||||||
|
networks: ["nats"]
|
||||||
|
depends_on: ["nats"]
|
||||||
nats-2:
|
nats-2:
|
||||||
image: nats
|
image: nats
|
||||||
command: "--cluster nats://0.0.0.0:6222 --routes=nats://ruser:T0pS3cr3t@nats:6222"
|
command: "--cluster nats://0.0.0.0:6222 --routes=nats://ruser:T0pS3cr3t@nats:6222"
|
||||||
|
networks: ["nats"]
|
||||||
|
depends_on: ["nats"]
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
nats:
|
||||||
external:
|
name: nats
|
||||||
name: nats
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Now we use Docker Compose to create the cluster that will be using the `nats` network:
|
Now we use Docker Compose to create the cluster that will be using the `nats` network:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker network create nats
|
|
||||||
|
|
||||||
$ docker-compose -f nats-cluster.yaml up
|
$ docker-compose -f nats-cluster.yaml up
|
||||||
Recreating docs_nats_1 ... done
|
Recreating docs_nats_1 ... done
|
||||||
Recreating docs_nats-2_1 ... done
|
Recreating docs_nats-2_1 ... done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user