How to set docker-compose to start NSQ data persistence?

as shown in the figure, officially describes how to use docker-compose to start several services of nsq. Shared data volumes are not configured in docker-compose, but how to enable persistence is described in Persisting NSQ Data. How to configure this in docker-compose?

clipboard.png

docker-compose.yml nsql :


nsqd volumes

clipboard.png

after the service is restarted, the data of the nsq background management system is gone.

Mar.21,2021

There is a problem with the setting of

data. You need to make a -data-dir parameter

.
version: '3'
services:
  nsqlookupd:
    image: nsqio/nsq
    command: /nsqlookupd
    ports:
      - "4160:4160"
      - "4161:4161"
  nsqd:
    image: nsqio/nsq
    command: /nsqd -data-path=/data --broadcast-address=192.168.2.13 --lookupd-tcp-address=nsqlookupd:4160
    volumes:
      - {{your data path}}:/data
    depends_on:
      - nsqlookupd
    ports:
      - "4150:4150"
      - "4151:4151"
  nsqadmin:
    image: nsqio/nsq
    command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
    depends_on:
      - nsqlookupd  
    ports:
      - "4171:4171"
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea48d1-1ce5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea48d1-1ce5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?