@@ -33,6 +33,46 @@
33-- > ["slave", host, port] -> do
33-- > ["slave", host, port] -> do
34-- > backend <- initializeBackend host port initRemoteTable
34-- > backend <- initializeBackend host port initRemoteTable
35-- > startSlave backend
35-- > startSlave backend
37+-- [Compiling and Running]
39+-- Save to @example.hs@ and compile using
41+-- > ghc -threaded example.hs
43+-- Fire up some slave nodes (for the example, we run them on a single machine):
45+-- > ./example slave localhost 8080 &
46+-- > ./example slave localhost 8081 &
47+-- > ./example slave localhost 8082 &
48+-- > ./example slave localhost 8083 &
50+-- And start the master node:
52+-- > ./example master localhost 8084
54+-- which should then output:
56+-- > Slaves: [nid://localhost:8083:0,nid://localhost:8082:0,nid://localhost:8081:0,nid://localhost:8080:0]
58+-- at which point the slaves should exit.
60+-- To run the example on multiple machines, you could run
62+-- > ./example slave 198.51.100.1 8080 &
63+-- > ./example slave 198.51.100.2 8080 &
64+-- > ./example slave 198.51.100.3 8080 &
65+-- > ./example slave 198.51.100.4 8080 &
67+-- on four different machines (with IP addresses 198.51.100.1..4), and run the
68+-- master on a fifth node (or on any of the four machines that run the slave
71+-- It is important that every node has a unique (hostname, port number) pair,
72+-- and that the hostname you use to initialize the node can be resolved by
73+-- peer nodes. In other words, if you start a node and pass hostname @localhost@
74+-- then peer nodes won't be able to reach it because @localhost@ will resolve
75+-- to a different IP address for them.
36{-# OPTIONS_GHC -fno-warn-orphans #-}
76{-# OPTIONS_GHC -fno-warn-orphans #-}
37module Control.Distributed.Process.Backend.SimpleLocalnet
77module Control.Distributed.Process.Backend.SimpleLocalnet
38 ( -- * Initialization
78 ( -- * Initialization