title: Jitsi Video bridge component, prosody, loadbalancing
body: <p>I’m setting up an auto-scalled loadbalanced environment using jitsi on AWS, it will autoscale jitsi-videobridge instances connecting them to prosody.</p>
  
  <p>I’ve followed this guide:
  <a href="https://github.com/jitsi/jicofo/blob/master/doc/load_balancing.md" rel="nofollow noreferrer">https://github.com/jitsi/jicofo/blob/master/doc/load_balancing.md</a> </p>
  
  <p>am I supposed to create separate components for each individual jitsi-videobridge instance at prosody ?
  Or am I missing something at the configuration ?
  If I understand this correctly, you have separate nodes of jitsi-videobridge talking to XMPP server and sending statistics via PUBSUB where Jicofo does the logic behind loadbalancing of these jitsi-videobridges.</p>
  
  <p>Thanks a lot !</p>
  
  <p>When I try to connect the second jitsi-videobridge into prosody I’m getting this error:</p>
  
  <p>Output from JVB:</p>
  
  <pre><code>JVB 2017-05-17 15:38:46.808 SEVERE: [33] org.jitsi.meet.ComponentMain.call().278 conflict, host: IP, port:5347
  org.xmpp.component.ComponentException: conflict
          at org.jivesoftware.whack.ExternalComponent.connect(ExternalComponent.java:219)
          at org.jivesoftware.whack.ExternalComponentManager.addComponent(ExternalComponentManager.java:221)
          at org.jivesoftware.whack.ExternalComponentManager.addComponent(ExternalComponentManager.java:201)
          at org.jitsi.meet.ComponentMain$3.call(ComponentMain.java:270)
          at org.jitsi.meet.ComponentMain$3.call(ComponentMain.java:255)
          at org.jitsi.retry.RetryStrategy$TaskRunner.run(RetryStrategy.java:193)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>Output from PROSODY:</p>
  
  <pre><code>mod_component   info    Disconnecting component, &lt;stream:error&gt; is: &lt;stream:error&gt;&lt;conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams'/&gt;&lt;text xmlns='urn:ietf:params:xml:ns:xmpp-streams'&gt;Component already connected&lt;/text&gt;&lt;/stream:error&gt;
  May 17 15:39:16 jcp20c3ae0      info    component disconnected: jitsi-videobridge.domainname.com (false)
  </code></pre>
  
  <p>The config file from PROSODY:</p>
  
  <pre><code>VirtualHost "pubsub.domainname"
      admins= {  "jitsi-videobridge.domainname” }
      modules_enabled = {
          "pubsub";
      }
  
  VirtualHost "domainname"
      authentication = "anonymous"
      modules_enabled = {
          "bosh";
      }
      c2s_require_encryption = false
  
  VirtualHost "auth.domainname"
      authentication = "internal_plain"
  
  admins = { "focus@auth.domainname" }
  
  Component "conference.domainname" "muc"
  Component "jitsi-videobridge.domainname"
      component_secret = "password"
  Component "focus.domainname"
      component_secret = “password”
  </code></pre>
  
  <p>The config from JVB:</p>
  
  <pre><code># Jitsi Videobridge settings
  
  # sets the XMPP domain (default: none)
  JVB_HOSTNAME=domainname.com
  
  # sets the hostname of the XMPP server (default: domain if set, localhost otherwise)
  JVB_HOST=IP
  
  # sets the port of the XMPP server (default: 5275)
  JVB_PORT=5347
  
  # sets the shared secret used to authenticate to the XMPP server
  JVB_SECRET=password
  # extra options to pass to the JVB daemon
  JVB_OPTS="--apis=xmpp,rest"
  
  # adds java system props that are passed to jvb (default are for home and logging config file)
  JAVA_SYS_PROPS="$JVB_EXTRA_JVM_PARAMS -Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi -Djava.util.logging.config.file=/etc/jitsi/videobridge/logging.properties"
  </code></pre>