doc.dev1x.org

NSQのDockerコンテナを立ち上げる

概要

コンテナ作成

docker-compose.yaml

version: '3.7'
services:
  nsqlookupd:
    image: nsqio/nsq
    command: /nsqlookupd
    ports:
      - "4160"
      - "4161"
  nsqd:
    image: nsqio/nsq
    command: /nsqd --lookupd-tcp-address=nsqlookupd:4160
    depends_on:
      - nsqlookupd
    ports:
      - "4150"
      - "4151"
  nsqadmin:
    image: nsqio/nsq
    command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
    depends_on:
      - nsqlookupd
    ports:
      - "4171"

コンテナ起動

docker-compose up -d
docker-compose ps

        Name                       Command               State                                                               Ports
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
nsq-test_nsqadmin_1     /nsqadmin --lookupd-http-a ...   Up      4150/tcp, 4151/tcp, 4160/tcp, 4161/tcp, 4170/tcp, 0.0.0.0:49157->4171/tcp,:::49157->4171/tcp
nsq-test_nsqd_1         /nsqd --lookupd-tcp-addres ...   Up      0.0.0.0:49156->4150/tcp,:::49156->4150/tcp, 0.0.0.0:49155->4151/tcp,:::49155->4151/tcp, 4160/tcp, 4161/tcp, 4170/tcp, 4171/tcp
nsq-test_nsqlookupd_1   /nsqlookupd                      Up      4150/tcp, 4151/tcp, 0.0.0.0:49154->4160/tcp,:::49154->4160/tcp, 0.0.0.0:49153->4161/tcp,:::49153->4161/tcp, 4170/tcp, 4171/tcp

設定メモ

NSQD

-tcp-address string : to listen on for TCP clients (default "0.0.0.0:4150")

-http-address string : to listen on for HTTP clients (default "0.0.0.0:4151")

-https-address string : to listen on for HTTPS clients (default "0.0.0.0:4152")

nsqlookupd

-tcp-address string : to listen on for TCP clients (default "0.0.0.0:4160")

-http-address string : to listen on for HTTP clients (default "0.0.0.0:4161")

nsqadmin

-http-address string : to listen on for HTTP clients (default "0.0.0.0:4171")

参考資料