salt一键部署hadoop

1.准备工作

 

2.salt关于hadoop的部署脚本,就是上面的init.sls中的内容,至于下面的内容的每一项的意思在之前jdk的脚本中有写。

hadoop-file:
  file.managed:
   - source: salt://hadoop/hadoop-2.7.3.tar.gz
   - name: /opt/hadoop-2.7.3.tar.gz
   - user: root
   - group: root

hadoop-install:
  cmd.run:
   - name: 'cd /opt && tar zxf hadoop-2.7.3.tar.gz && ln -s hadoop-2.7.3/ hadoop && chown -R hadoop:hadoop /opt/hadoop*'
   - unless: 'test -d /opt/hadoop-2.7.3'
   - require:
     - file: hadoop-file
 
hadoop-rmtgz:
  file.absent:
    - name: /opt/hadoop-2.7.3.tar.gz
	- require:
     - cmd: hadoop-install
	 
/etc/profile:
  file.append:
    - text:
      - export HADOOP_HOME=/opt/hadoop
      - export PATH=$HADOOP_HOME/bin:$PATH
	- require:
      - file: hadoop-rmtgz
	  
source-profile:
   cmd.run:
    - name: 'source /etc/profile'
	- require:
      - file: /etc/profile

3.其余的操作步骤和之前jdk,python类似这里就不写啦。

posted @ 2017-05-17 09:47  wyl9527  阅读(591)  评论(0编辑  收藏  举报