# Copyright 2018-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# The cluster configuration defines how the nodes in the cluster join and communicate with one another.
cluster {

  # The 'discovery' configuration specifies the protocol used to discover members of the cluster.
  # The 'bootstrap' discovery protocol is typically used for consensus-based clusters since
  # static identities are required for the safe operation of the Raft protocol anyways.
  # The bootstrap protocol lists a set of members through which the current cluster configuration
  # can be retrieved and should typically consist of the members of Raft partition groups.
  discovery {
    type: bootstrap
    nodes.1 {
      id: atomix-1
      address: "10.192.19.171:5679"
    }
    nodes.2 {
      id: atomix-2
      address: "10.192.19.172:5679"
    }
    nodes.3 {
      id: atomix-3
      address: "10.192.19.173:5679"
    }
  }
}

# The management group is used by the system to store primitive, session, and transaction information.
# This must be a Raft partition group for strongly consistent clusters.
managementGroup {
  type: raft
  partitions: 1
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}

# An additional Raft partition group should be added for storing Raft-based primitives.
# The number of partitions in the group is the number of distinct Raft clusters and should
# typically be equal to 1 or 2 times the number of members in the group. The 'partitionSize'
# if the size of each Raft partition. The members in the group must be explicitly listed in the
# 'members' field for safety.
partitionGroups.consensus {
  type: raft
  partitions: 7
  partitionSize: 3
  storage.level: mapped
  members: [atomix-1, atomix-2, atomix-3]
}
