Search code examples
docker-composedocker-volumeqdrant

Being told unavailable while docker composing 2 qdrant services with 1 volume mount


Here's error log first:

qdrant-distributed-deployment-qdrant_secondary-1  | 2024-01-09T12:09:00.369285Z ERROR qdrant::startup: Panic backtrace:
qdrant-distributed-deployment-qdrant_secondary-1  |    0: qdrant::startup::setup_panic_hook::{{closure}}
qdrant-distributed-deployment-qdrant_secondary-1  |    1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
qdrant-distributed-deployment-qdrant_secondary-1  |              at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/alloc/src/boxed.rs:2021:9
qdrant-distributed-deployment-qdrant_secondary-1  |    2: std::panicking::rust_panic_with_hook
qdrant-distributed-deployment-qdrant_secondary-1  |              at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:735:13
qdrant-distributed-deployment-qdrant_secondary-1  |    3: std::panicking::begin_panic_handler::{{closure}}
qdrant-distributed-deployment-qdrant_secondary-1  |              at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:609:13
qdrant-distributed-deployment-qdrant_secondary-1  |    4: std::sys_common::backtrace::__rust_end_short_backtrace
qdrant-distributed-deployment-qdrant_secondary-1  |              at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:170:18
qdrant-distributed-deployment-qdrant_secondary-1  |    5: rust_begin_unwind
qdrant-distributed-deployment-qdrant_secondary-1  |              at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5
qdrant-distributed-deployment-qdrant_secondary-1  |    6: core::panicking::panic_fmt
qdrant-distributed-deployment-qdrant_secondary-1  |              at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14
qdrant-distributed-deployment-qdrant_secondary-1  |    7: core::result::unwrap_failed
qdrant-distributed-deployment-qdrant_secondary-1  |              at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/result.rs:1652:5
qdrant-distributed-deployment-qdrant_secondary-1  |    8: storage::content_manager::consensus_manager::ConsensusManager<C>::new
qdrant-distributed-deployment-qdrant_secondary-1  |    9: qdrant::main
qdrant-distributed-deployment-qdrant_secondary-1  |   10: std::sys_common::backtrace::__rust_begin_short_backtrace
qdrant-distributed-deployment-qdrant_secondary-1  |   11: main
qdrant-distributed-deployment-qdrant_secondary-1  |   12: <unknown>
qdrant-distributed-deployment-qdrant_secondary-1  |   13: __libc_start_main
qdrant-distributed-deployment-qdrant_secondary-1  |   14: _start
qdrant-distributed-deployment-qdrant_secondary-1  |
qdrant-distributed-deployment-qdrant_secondary-1  | 2024-01-09T12:09:00.369299Z ERROR qdrant::startup: Panic occurred in file lib/storage/src/content_manager/consensus/consensus_wal.rs at line 22: Can't open Collections meta Wal: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }
qdrant-distributed-deployment-qdrant_secondary-1 exited with code 101

Here's my docker-compose.yaml:

version: '3.9'
services:
  qdrant_primary:
    image: "qdrant/qdrant:v1.7.3"
    volumes:
      - qdrant_storage:/qdrant/storage
    ports:
      - "6333:6333"
    environment:
      QDRANT__CLUSTER__ENABLED: "true"
    command: ["./qdrant", "--uri", "http://qdrant_primary:6335"]
  qdrant_secondary:
    image: "qdrant/qdrant:v1.7.3"
    volumes:
      - qdrant_storage:/qdrant/storage
    environment:
      QDRANT__CLUSTER__ENABLED: "true"
    command: ["./qdrant", "--bootstrap", "http://qdrant_primary:6335"]
volumes:
  qdrant_storage:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /Users/test_qdrant

I was trying to test distributed deployment of qdrant with docker-compose on my Mac, but my 2 services just can't compose up both. Is it because the mount path was used by qdrant_primary then the second one could access it? How can I configure my yaml to handle this situation? Sorry for my rookie on docker


Solution

  • Different Qdrant instances (nodes) must use different storage directories. You're currently trying to use the same storage directory for multiple nodes, which is why this error shows up.

    Keeping your original Docker compose file mostly intact, you'd likely want to change it to use separate volumes like this:

    version: '3.9'
    services:
      qdrant_primary:
        image: "qdrant/qdrant:v1.7.3"
        volumes:
          - qdrant_storage_primary:/qdrant/storage
        ports:
          - "6333:6333"
        environment:
          QDRANT__CLUSTER__ENABLED: "true"
        command: ["./qdrant", "--uri", "http://qdrant_primary:6335"]
      qdrant_secondary:
        image: "qdrant/qdrant:v1.7.3"
        volumes:
          - qdrant_storage_secondary:/qdrant/storage
        environment:
          QDRANT__CLUSTER__ENABLED: "true"
        command: ["./qdrant", "--bootstrap", "http://qdrant_primary:6335"]
    volumes:
      qdrant_storage_primary:
        driver: local
        driver_opts:
          type: none
          o: bind
          device: /Users/test_qdrant_primary
      qdrant_storage_secondary:
        driver: local
        driver_opts:
          type: none
          o: bind
          device: /Users/test_qdrant_secondary
    

    Your data is spread across nodes on collection creation, after which Qdrant will take care of synchronizing all of it based on your configuration and usage.