Skip to content
CCPEDIAby Unity Nodes
App Development

Changing Domain Connection Config

7 posts376 views1 likesLast activity Apr 2023

  1. bernhardOP

    Suppose I have a participant already connected to a domain. Now I’ve set up a sequencer replica and want to activate client-side load balancing. How do I change the domain connection configuration from one URL to two?

  2. bernhard

    Same question for mediator and domain manager. Do I just overwrite it using

    mediator.sequencer_connection.set(???)
    

    And for the domain manager?

  3. bernhard

    For a participant:

    participant1.domains.modify("sequencer1", _.addConnection("http://localhost:4411"))
    

    For Mediator and Domain Manager:

    {
    import com.digitalasset.canton.networking.Endpoint
    val endpoint1 = Endpoint("localhost", Port.tryCreate(4401))
    val endpoint2 = Endpoint("localhost", Port.tryCreate(4411))
    import com.digitalasset.canton.sequencing.GrpcSequencerConnection
    import com.daml.nonempty.NonEmpty
    val grpcConnWithBoth = GrpcSequencerConnection(
        NonEmpty(Seq, endpoint1, endpoint2),
        false,
        None,
      )
    mediator.sequencer_connection.set(grpcConnWithBoth)
    }
    
  4. Frankie

    @bernhard , what about participant updating HA connection endpoint?

    Do I need to participant2.domains.modify and then participant2.domains.connect_ha? and provide the endpoints twice in the two commands?

  5. Frankie 1

    I got it working by using modify and reconnect()

    @ participant2.domains.disconnect("remote-domain")
    
    @ val endpoint1 = Endpoint("localhost", Port.tryCreate(10018)) 
    endpoint1: Endpoint = Endpoint(host = "localhost", port = 10018)
    
    @ val endpoint2 = Endpoint("localhost", Port.tryCreate(20018)) 
    endpoint2: Endpoint = Endpoint(host = "localhost", port = 20018)
    
    
    import com.daml.nonempty.NonEmpty
    import com.digitalasset.canton.sequencing.GrpcSequencerConnection
    
    @ val haConnection = GrpcSequencerConnection(NonEmpty(Seq, endpoint1, endpoint2), false, None) 
    
    haConnection: GrpcSequencerConnection = GrpcSequencerConnection(
      endpoints = Seq(http://localhost:10018, http://localhost:20018),
      transportSecurity = false,
      customTrustCertificates = None()
    )
    
    @ participant2.domains.modify("remote-domain", _.copy(sequencerConnection = haConnection)) 
    
    @ participant2.domains.reconnect("remote-domain") 
    
    
  6. Frankie

    Hi @bernhard , Just noticed that connect_ha is deprecated. (Console Commands — Daml SDK 2.6.3 documentation)Should we use connect_multi instead? And what is the differences between the two?

  7. bernhard

    Hi @Frankie , just use connect_multi instead. It was API tidy-up so connect_ha is an alias for connect_multi.