salt一鍵部署kafka

2022-06-27 13:30:12 字數 3319 閱讀 3658

1.準備工作:

2.salt關於kafka的部署指令碼,就是上面的init.sls中的內容,至於下面的內容的每一項的意思在之前jdk的指令碼中有寫。

kafka-file:

file.managed:

- source: salt://kafka/kafka_2.11-0.9.0.0.tar.gz

- name: /opt/kafka_2.11-0.9.0.0.tar.gz

- user: root

- group: root

kafka-install:

cmd.run:

- name: 'cd /opt && tar zxf kafka_2.11-0.9.0.0.tar.gz && ln -s kafka_2.11-0.9.0.0 kafka && chown -r hadoop:hadoop /opt/kafka*'

- unless: 'test -d /opt/kafka_2.11-0.9.0.0'

- require:

- file: kafka-file

kafka-rmtgz:

file.absent:

- name: /opt/kafka_2.11-0.9.0.0.tar.gz

- require:

- cmd: kafka-install

/etc/profile:

- text:

- export kafka_home=/opt/kafka

- export path=$kafka_home/bin:$path

- require:

- file: kafka-rmtgz

source-profile:

cmd.run:

- name: 'source /etc/profile'

- require:

- file: /etc/profile

3.salt執行該一鍵部署指令碼

內容顯示如下:

s3:

----------

id: kafka-file

function: file.managed

name: /opt/kafka_2.11-0.9.0.0.tar.gz

result: true

comment: file /opt/kafka_2.11-0.9.0.0.tar.gz updated

started: 07:57:54.854046

duration: 1892.178 ms

changes:

----------

diff:

new file

mode:

0644

----------

id: kafka-install

function: cmd.run

name: cd /opt && tar zxf kafka_2.11-0.9.0.0.tar.gz && ln -s kafka_2.11-0.9.0.0 kafka && chown -r hadoop:hadoop /opt/kafka*

result: true

comment: command "cd /opt && tar zxf kafka_2.11-0.9.0.0.tar.gz && ln -s kafka_2.11-0.9.0.0 kafka && chown -r hadoop:hadoop /opt/kafka*" run

started: 07:57:56.747888

duration: 402.739 ms

changes:

----------

pid:

2806

retcode:

0stderr:

stdout:

----------

id: kafka-rmtgz

function: file.absent

name: /opt/kafka_2.11-0.9.0.0.tar.gz

result: true

comment: removed file /opt/kafka_2.11-0.9.0.0.tar.gz

started: 07:57:57.150965

duration: 5.899 ms

changes:

----------

removed:

/opt/kafka_2.11-0.9.0.0.tar.gz

----------

id: /etc/profile

result: true

started: 07:57:57.157009

duration: 6.193 ms

changes:

----------

diff:

---

+++

@@ -91,3 +91,5 @@

export master=bgs-5p173-wangwenting

export path=/opt/python/bin:$path

+export kafka_home=/opt/kafka

+export path=$kafka_home/bin:$path

----------

id: source-profile

function: cmd.run

name: source /etc/profile

result: true

comment: command "source /etc/profile" run

started: 07:57:57.163374

duration: 29.547 ms

changes:

----------

pid:

2811

retcode:

0stderr:

stdout:

summary for s3

------------

succeeded: 5 (changed=5)

failed: 0

------------

total states run: 5

total run time: 2.337 s

4.其餘的操作步驟和之前jdk,python類似這裡就不寫啦。

salt一鍵部署hadoop

1.準備工作 2.salt關於hadoop的部署指令碼,就是上面的init.sls中的內容,至於下面的內容的每一項的意思在之前jdk的指令碼中有寫。hadoop file file.managed source salt hadoop hadoop 2.7.3.tar.gz name opt had...

salt一鍵部署python

1.準備工作 我們來看一下一鍵部署python的指令碼。python file file.managed source salt python python 2.7.8.tar.gz name opt python 2.7.8.tar.gz user root group root python i...

ceph 一鍵部署

首先先讚乙個,ceph很強大。部署很方便。寫了乙個半自動化部署指令碼,第一次寫高手飄過。過些時間來做成完全一鍵部署。我的測試環境 mon msd 我是安裝到一台伺服器上面,資料節點安裝了4臺伺服器 使用說明 1 mon msd osd 都需要執行 config ceph.sh install hos...