Add an example for leader election based multiple controller
This commit is contained in:
parent
658b7448da
commit
ce56d2b7be
14 changed files with 242 additions and 0 deletions
21
examples/leader_example/config/config.exs
Normal file
21
examples/leader_example/config/config.exs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Mix.Config module.
|
||||
use Mix.Config
|
||||
|
||||
config :libcluster,
|
||||
topologies: [
|
||||
gossip_example: [
|
||||
strategy: Cluster.Strategy.Gossip,
|
||||
config: [
|
||||
port: 45_892,
|
||||
if_addr: {0, 0, 0, 0},
|
||||
multicast_addr: {230, 1, 1, 251},
|
||||
multicast_ttl: 1]]]
|
||||
|
||||
config :logger,
|
||||
level: :debug,
|
||||
format: "$date $time [$level] $metadata$message\n",
|
||||
metadata: [:application],
|
||||
handle_otp_reports: true
|
||||
|
||||
import_config "#{Mix.env}.exs"
|
||||
3
examples/leader_example/config/dev.exs
Normal file
3
examples/leader_example/config/dev.exs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Mix.Config module.
|
||||
use Mix.Config
|
||||
9
examples/leader_example/config/node1.exs
Normal file
9
examples/leader_example/config/node1.exs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use Mix.Config
|
||||
|
||||
config :tres,
|
||||
protocol: :tcp,
|
||||
port: 6653,
|
||||
max_connections: 10,
|
||||
num_acceptors: 10,
|
||||
callback_module: LeaderExample.Leader,
|
||||
callback_args: []
|
||||
9
examples/leader_example/config/node2.exs
Normal file
9
examples/leader_example/config/node2.exs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use Mix.Config
|
||||
|
||||
config :tres,
|
||||
protocol: :tcp,
|
||||
port: 6633,
|
||||
max_connections: 10,
|
||||
num_acceptors: 10,
|
||||
callback_module: LeaderExample.Leader,
|
||||
callback_args: []
|
||||
Loading…
Add table
Add a link
Reference in a new issue