mosuka / blast

Blast is a full text search and indexing server, written in Go, built on top of Bleve.
Apache License 2.0
1.08k stars 76 forks source link

leadership lost in docker-compose #138

Closed dkatargin closed 4 years ago

dkatargin commented 4 years ago

Hi! I trying to run blast cluster in docker-compose and catch error

master-node_1   | {"_level_":"error","_timestamp_":"2020-06-29T14:06:34.334Z","_name_":"blast","_caller_":"server/raft_server.go:640","_message_":"failed to add voter","id":"node2","raft_address":":7001","error":"leadership lost while committing log"}
master-node_1   | {"_level_":"error","_timestamp_":"2020-06-29T14:06:34.335Z","_name_":"blast","_caller_":"server/grpc_service.go:232","_message_":"failed to join node to the cluster","id":"node2","error":"leadership lost while committing log"}
master-node_1   | {"_level_":"error","_timestamp_":"2020-06-29T14:06:34.335Z","_name_":"blast","_caller_":"server/raft_server.go:594","_message_":"failed to apply message bytes","timeout":60,"error":"leadership lost while committing log"}

It's not RC between nodes and single master-node works fine. Can you help with this? Full log docker-compose.yml

mosuka commented 4 years ago

@ex0hunt Sorry, it took me so long to reply. And I'm sorry for the inconvenience. I released v0.9.1 and also pushed containers to Docker Hub. Please use it.

I'll try your docker-compose.yml when I have time.

Thanks!

pffreitas commented 4 years ago

@ex0hunt,

You need to specify raft, grpc and HTTP addresses including the node name, e.g. --grpc-address=extend-node2:9002 rather than --grpc-address=:9002

Here's the full docker-compose.yaml:

version: "3.4"

services:
  master-node:
    image: mosuka/blast
    ports:
      - 7000:7000
      - 8000:8000
      - 9000:9000
    entrypoint: /bin/bash -c
    command: >
      "blast start --id=node1 --raft-address=master-node:7000 --http-address=master-node:8000 --grpc-address=master-node:9000 --peer-grpc-address=master-node:9000 --data-directory=/tmp/blast/node1"

  extend-node1:
    image: mosuka/blast
    ports:
      - 7001:7001
      - 8001:8001
      - 9001:9001
    depends_on:
      - master-node
    links:
      - master-node
    entrypoint: /bin/bash -c
    command: >
      "sleep 10; blast start --id=node2 --raft-address=extend-node1:7001 --http-address=extend-node1:8001 --grpc-address=extend-node1:9001 --peer-grpc-address=master-node:9000 --data-directory=/tmp/blast/node2 "

  extend-node2:
    image: mosuka/blast
    ports:
      - 7002:7002
      - 8002:8002
      - 9002:9002
    depends_on:
      - master-node
    links:
      - master-node
    entrypoint: /bin/bash -c
    command: >
      "sleep 15; blast start --id=node3 --raft-address=extend-node2:7002 --http-address=extend-node2:8002 --grpc-address=extend-node2:9002 --peer-grpc-address=master-node:9000 --data-directory=/tmp/blast/node3 "
dkatargin commented 4 years ago

@pffreitas yes, it works! Thank you!