Add an example for leader election based multiple controller

This commit is contained in:
Eishun Kondoh 2018-02-09 00:49:57 +09:00
parent 658b7448da
commit ce56d2b7be
14 changed files with 242 additions and 0 deletions

View 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"

View 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

View 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: []

View 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: []