Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Added Lithium Split Brain Resolver #245

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ val nimbusJoseJwtVersion = "8.4"
val pureconfigVersion = "0.12.2"
val scalaLoggingVersion = "3.9.2"
val scalaTestVersion = "3.1.0"
val splitBrainLithiumVersion = "0.10.0"
val kryoVersion = "1.1.0"

// Dependencies modules
Expand Down Expand Up @@ -73,6 +74,7 @@ lazy val nimbusJoseJwt = "com.nimbusds" % "nimbus-jose-jwt"
lazy val pureconfig = "com.github.pureconfig" %% "pureconfig" % pureconfigVersion
lazy val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion
lazy val scalaTest = "org.scalatest" %% "scalatest" % scalaTestVersion
lazy val splitBrainLithium = "com.swissborg" %% "lithium" % splitBrainLithiumVersion
lazy val kryo = "io.altoo" %% "akka-kryo-serialization" % kryoVersion

lazy val iam = project
Expand All @@ -84,7 +86,7 @@ lazy val iam = project
name := "iam",
moduleName := "iam",
Docker / packageName := "nexus-iam",
resolvers += "dnvriend" at "https://dl.bintray.com/dnvriend/maven",
resolvers ++= Seq("dnvriend" at "https://dl.bintray.com/dnvriend/maven", "swissborg" at "https://dl.bintray.com/swissborg/maven"),
libraryDependencies ++= Seq(
commonsCore,
commonsKamon,
Expand All @@ -107,6 +109,7 @@ lazy val iam = project
nimbusJoseJwt,
pureconfig,
scalaLogging,
splitBrainLithium,
akkaTestKit % Test,
akkaHttpTestKit % Test,
akkaStreamTestKit % Test,
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/akka.conf
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ akka {
"scala.util.Left" = kryo
"scala.util.Right" = kryo
"com.nimbusds.jose.jwk.JWKSet" = kryo
"com.swissborg.lithium.internals.LithiumSeenChanged" = kryo
}
}

cluster {
min-nr-of-members = 1
min-nr-of-members = ${?CLUSTER_MIN_NR_OF_MEMBERS}
sharding.state-store-mode = ddata
downing-provider-class = "com.swissborg.lithium.DowningProviderImpl"
downing-provider-class = ${?DOWNING_PROVIDER_CLASS}
}

remote {
Expand Down Expand Up @@ -114,4 +117,22 @@ akka-kryo-serialization {
post-serialization-transformations = ${?KRYO_COMPRESSION}

kryo-initializer = "ch.epfl.bluebrain.nexus.iam.io.KryoSerializerInit"
}

com.swissborg.lithium {
# The name of the strategy to use for split-brain resolution.
# Available: static-quorum, keep-majority, keep-referee, keep-oldest.
active-strategy = "keep-oldest"
active-strategy = ${?SPLIT_BRAIN_ACTIVE_STRATEGY}
keep-oldest {
# Down the oldest member when alone.
down-if-alone = yes
down-if-alone = ${?SPLIT_BRAIN_KEEP_OLDEST_DOWN_IF_ALONE}
role = ""
}

# Duration during which the cluster must be stable before taking action on the network-partition.
# The duration must chose large enough to allow for membership events to be gossiped and persistent actor to be migrated.
stable-after = 30s
stable-after = ${?SPLIT_BRAIN_STABLE_AFTER}
}