0

I'm new in VerneMQ and K8s. I have a working VerneMQ docker image (made from source) deployed with 2 replicas on GKE. They work fine, but i have to manualy connect into one container and ejecute:

vmq-admin cluster join discovery-node=<OtherClusterNode>

so they can find each other and join in a VerneMQ Cluster.

Is there a way they can discover for each other and join in a cluster when container start?, not manually each time i rebuild the containers

I was thinking in fixing somehow each verne node name and running a script (only in one container) to join the cluster, but it feels hacky.

My main problem is that in the meantime between containers starts and the execution of the vmq-admin cluster join command, i have 2 independent vernemq servers and a subsciber may connect to a diferent server than the consumer.

My deployment yaml looks like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: broker-verne-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      servicio: bkr-verne
  template:
    metadata:
      labels:
        servicio: bkr-verne
    spec:
      containers:
        - name: broker-verne
          image: gcr.io/<my project id>/broker-verne/master
          ports:
            - containerPort: 80
            - containerPort: 1883
            - containerPort: 8883
            - containerPort: 8888
            - containerPort: 8080
          env:
            - name: DOCKER_VERNEMQ_LOG__CONSOLE
              value: 'both'
            - name: DOCKER_VERNEMQ_LOG__CONSOLE__LEVEL
              value: 'debug'

Thanks

Leo
  • 1
  • You may find useful this [VerneMQ's official documentation about Inter-node Communication in Clustering](https://docs.vernemq.com/clustering/communication) where they provide details on how to set each *vmq* listener. must be configured in the vernemq.conf. listener.vmq.clustering = 0.0.0.0:44053 Please could you clarify what do you mean when talking about subscriber may connect to a different server than the consumer. – Pit Jun 22 '21 at 11:04
  • thanks i'll give it a try. I mean when i deploy 2 verne servers on 2 pods they are independent broker and don't see each other. the load balancer might send a conection to one pod and another conection to the other pod and they won't see each other messages until i run the command to join the 2 vernemq servers into a cluster – Leo Jun 27 '21 at 05:10

0 Answers0