salt一键部署habse
1.准备工作

2.salt关于hbase的部署脚本,就是上面的init.sls中的内容,至于下面的内容的每一项的意思在之前jdk的脚本中有写。
hbase-file:
file.managed:
- source: salt://hbase/hbase-1.2.4.tar.gz
- name: /opt/hbase-1.2.4.tar.gz
- include_empty: True
- user: root
- group: root
hbase-install:
cmd.run:
- name: 'cd /opt && tar zxf hbase-1.2.4.tar.gz && ln -s hbase-1.2.4 hbase && chown -R hadoop:hadoop /opt/hbase*'
- unless: 'test -d /opt/hbase-1.2.4'
- require:
- file: hbase-file
hbase-rmtgz:
file.absent:
- name: /opt/hbase-1.2.4.tar.gz
- require:
- cmd: hbase-install
/etc/profile:
file.append:
- text:
- export HBASE_HOME=/opt/hbase
- export PATH=$HBASE_HOME/bin:$PATH
- require:
- file: hbase-rmtgz
source-profile:
cmd.run:
- name: 'source /etc/profile'
- require:
- file: /etc/profile
3.其余的操作步骤和之前jdk,python类似这里就不写啦。

s1:
----------
ID: hbase-file
Function: file.managed
Name: /opt/hbase-1.2.4.tar.gz
Result: True
Comment: File /opt/hbase-1.2.4.tar.gz updated
Started: 19:47:08.491127
Duration: 3531.534 ms
Changes:
----------
diff:
New file
mode:
0644
----------
ID: hbase-install
Function: cmd.run
Name: cd /opt && tar zxf hbase-1.2.4.tar.gz && ln -s hbase-1.2.4 hbase && chown -R hadoop:hadoop /opt/hbase*
Result: True
Comment: Command "cd /opt && tar zxf hbase-1.2.4.tar.gz && ln -s hbase-1.2.4 hbase && chown -R hadoop:hadoop /opt/hbase*" run
Started: 19:47:12.024056
Duration: 3094.791 ms
Changes:
----------
pid:
5810
retcode:
0
stderr:
stdout:
----------
ID: hbase-rmtgz
Function: file.absent
Name: /opt/hbase-1.2.4.tar.gz
Result: True
Comment: Removed file /opt/hbase-1.2.4.tar.gz
Started: 19:47:15.119234
Duration: 22.845 ms
Changes:
----------
removed:
/opt/hbase-1.2.4.tar.gz
----------
ID: /etc/profile
Function: file.append
Result: True
Comment: File /etc/profile is in correct state
Started: 19:47:15.142236
Duration: 4.787 ms
Changes:
----------
ID: source-profile
Function: cmd.run
Name: source /etc/profile
Result: True
Comment: Command "source /etc/profile" run
Started: 19:47:15.147217
Duration: 25.962 ms
Changes:
----------
pid:
5824
retcode:
0
stderr:
stdout:
Summary for s1
------------
Succeeded: 5 (changed=4)
Failed: 0
------------
Total states run: 5
Total run time: 6.680 s

浙公网安备 33010602011771号