A clojure DSL for system admin and deployment with many remote machines
1.What is clojure-control?
The idea came from node-control.
Define clusters and tasks for system administration or code deployment, then execute them on one or many remote machines.
Clojure-control depends only on OpenSSH and clojure on the local control machine.Remote machines simply need a standard sshd daemon.
2.Quick example
Get the current date from the two machines listed in the 'mycluster' config with a single command:
(:use [control.core :only [task cluster scp ssh begin]]))
;;define clusters
(cluster :mycluster
:clients [
{ :host "a.domain.com" :user "alogin"}
{ :host "b.domain.com" :user "blogin"}
])
;;define tasks
(task :date "Get date"
[]
(ssh "date"))
;;start running
(begin)
If saved in a file named "controls.clj",run with
Each machine execute "date" command ,and the output form the remote machine is printed to the console.Exmaple console output
Performing date for a.domain.com
a.domain.com:ssh: date
a.domain.com:stdout: Sun Jul 24 19:14:09 CST 2011
a.domain.com:exit: 0
Performing date for b.domain.com
b.domain.com:ssh: date
b.domain.com:stdout: Sun Jul 24 19:14:09 CST 2011
b.domain.com:exit: 0
Each line of output is labeled with the address of the machine the command was executed on. The actual command sent and the user used to send it is displayed. stdout and stderr output of the remote process is identified as well as the final exit code of the local ssh command.
3.How to scp files?
Let's define a new task named deploy
[]
(scp ("release1.tar.gz" "release2.tar.gz") "/home/alogin/"))
Then it will copy release1.tar.gz and release2.tar.gz to remote machine's /home/alogin directory.
4.Where is it?
It's on github,https://github.com/killme2008/clojure-control
Any suggestion or bug reports welcomed.
文章转自庄周梦蝶 ,原文发布时间2011-07-24
相关文章
- C语言高效得简直不合理
- 最全解析:大数据和机器学习有什么区别
- 在R中使用开源大规模预测工具Prophet
- 大数据的发展,伴随的将是软件工程师的渐退,算法工程师的崛起
- Eclipse基金会项目告别CVS,迁至Git
- Hadoop没有消亡,它是大数据的未来
- 机器学习项目中的数据预处理与数据整理之比较
- 谈谈IE针对Ajax请求结果的缓存
- 大数据分析之技术框架整理
- 我眼中的工程师文化
- 达观推荐算法实现:协同过滤之item embedding
- 常用排序算法比较与分析
- Java Web服务性能优化实践
- 数据和分析带来五大积极业务成果
- 干货|国内外十大主流采集软件盘点
- 大数据如何在制造企业中落地?
- 传统制造业面临大数据的7种改变方式
- 除了董明珠 家电领域有更值得关注的
- 六个提示 预防企业数据发生灾难
- Spark for python developers —Spark与数据的机器学习