Apparatus: Clojure Clusters
lein uberjar ;# create an uberjar
lein test ;# run the unit tests
nohup java -jar apparatus*standalone.jar & ;# background node (autostarts)
nohup java -jar apparatus*standalone.jar & ;# background node (autostarts)
lein repl ;# interactive node
Start up the foreground node
(use '[apparatus config cluster])
(instance (config))
Make your cluster do work
(-> (eval-any '(+ 1 1)) (.get))
Store some data in your cluster
(-> (get-map "helloworld") (.put "mah" "bukkit"))
(-> (get-map "helloworld") (.get "mah"))
Have the remote node, that owns the data locally, do something with it
(-> (eval-on
'(do (use 'apparatus.cluster) ;# remote work definition
(-> (get-map "helloworld")
(.get "mah")
(str " was found!")))
"mah") ;# node that owns "mah"
(.get)
(println))
Add apparatus lib to your project
(defproject myproject "1.2.3" :dependencies [[apparatus "1.0.0-SNAPSHOT"]])