ssh

Definition

์›๊ฒฉ host์— ssh ๋ช…๋ น์–ด ์‹คํ–‰์‹œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
์ขŒ์ธก [Flow๊ตฌ์„ฑ]๋…ธ๋“œ ์ค‘ [ssh]๋…ธ๋“œ๋ฅผ drag & drop ํ•œ ํ›„ Property ํ•ญ๋ชฉ์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. Property ํŒจ๋„์˜ [๋”๋ณด๊ธฐ+] ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์ž…๋ ฅ๊ฐ€๋Šฅํ•œ ์ „์ฒด Property ํ•ญ๋ชฉ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Set

[setting], [scheduler], [parameter] ์„ค์ •์€ [์›Œํฌํ”Œ๋กœ์šฐ] > [์ƒ์„ฑ] > [๊ธฐ๋ณธ๊ตฌ์„ฑ]์„ ์ฐธ๊ณ ํ•ฉ๋‹ˆ๋‹ค.

property

[Node Description] ์ž‘์„ฑ ์ค‘์ธ ๋…ธ๋“œ๋ช… ์ž…๋ ฅ

ssh01

  1. captionOutput : capture output ์—ฌ๋ถ€ ์„ ํƒ
  2. host : ssh host ์ž…๋ ฅ ex) user@host.com
  3. command : ์‹คํ–‰ํ•  command ์ž…๋ ฅ ex) ls
    • [Script Editor]๋ฅผ ์„ ํƒํ•ด์„œ ํŒ์—…๋œ editor๋ฅผ ํ†ตํ•ด ์ฝ”๋”ฉ ๊ฐ€๋Šฅ
  4. argument : ์ธ์ˆ˜ ์„ค์ •
  5. forceOK : ์‹คํŒจ ์‹œ ๊ฐ•์ œ OK ์ฒ˜๋ฆฌ ์—ฌ๋ถ€

Example

kbtest ํด๋Ÿฌ์Šคํ„ฐ Name Node์— ์œ„์น˜ํ•œ shell์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. shell ์œ„์น˜๋Š” dpcore ๊ณ„์ • ํ™ˆ๋””๋ ‰ํ† ๋ฆฌ(/home/dpcore/air.sh)๋ฉฐ, ๋™์ผ ์œ„์น˜์— air.sh์—์„œ ์ „์ฒ˜๋ฆฌํ•  csvํŒŒ์ผ(AIR_HOUR_2019_noh.csv)๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
air.sh์˜ ๋‚ด์šฉ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

awk -F"[,]" '$2 == "103" { print $0 }' ~dpcore/AIR_HOUR_2019_noh.csv > air_pollution_yongsan.csv
1> AIR_HOUR_2019_noh.csv ํŒŒ์ผ์—์„œ ๋‘๋ฒˆ์งธ ํ•„๋“œ๊ฐ’์ด 103์ธ ๋ ˆ์ฝ”๋“œ๋ฅผ air_pollution_yongsan.csv๋ผ๋Š” ํŒŒ์ผ๋กœ ์ถ”์ถœ
2> AIR_HOUR_2019_noh.csv ํŒŒ์ผ์€ fork/join ์˜ˆ์ œ์—์„œ ์‚ฌ์šฉํ•œ "์„œ์šธ์‹œ ๋Œ€๊ธฐ์˜ค์—ผ ์ •๋ณด" ๋ฐ์ดํ„ฐ
- station_cd(๊ด€์ธก์†Œ์ฝ”๋“œ)๊ฐ€ 103์€ ์šฉ์‚ฐ์— ์œ„์น˜ํ•œ ๊ด€์ธก์†Œ์—์„œ ์ธก์ •ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์˜๋ฏธ
  1. kbtest ํด๋Ÿฌ์Šคํ„ฐ์— ๊ฒ€์‚ฌ๋Œ€์ƒ ํŒŒ์ผ(/home/dpcore/AIR_HOUR_2019_noh.csv)๊ณผ shell(/home/dpcore/air.sh)์„ ์ ์žฌ
  2. [ssh] ๋…ธ๋“œ drag & drop ํ›„ ์•„๋ž˜์™€ ๊ฐ™์ด property ๊ฐ’ ์„ค์ •
    • [setting] ํŒจ๋„์—์„œ ์‹คํ–‰๋Œ€์ƒ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ kbtest๋กœ ์„ค์ •
    • [property] ํŒจ๋„์—์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์„ค์ •
      • [2.host] : dpcore@kbtest-accu-hdfs-nn
      • [3.command] : sh air.sh

[Note] ssh password-less
ssh ๋…ธ๋“œ ์‹คํ–‰์„ ์œ„ํ•ด ssh password-less ์„ค์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

  • server : ssh ์ ‘์†๋Œ€์ƒ host (example์—์„œ [2.host]์— ์ž…๋ ฅ๋˜๋Š” ์„œ๋ฒ„/๊ณ„์ •)
  • client : ssh ๋…ธ๋“œ๊ฐ€ ์‹คํ–‰๋˜๋Š” host (oozie๋ฅผ ๊ตฌ๋™ํ•˜๋Š” eco node)
  • client์˜ oozie, dpcore ๊ณ„์ • ๋Œ€์ƒ์œผ๋กœ password-less ์„ค์ •

[Note] ssh vs shell
shell command๋ฅผ ์‹คํ–‰์‹œํ‚จ๋‹ค๋Š” ์ ์—์„œ shell ๋…ธ๋“œ์™€ ์„ฑ๊ฒฉ์ด ์œ ์‚ฌํ•˜๋‚˜ ์•„๋ž˜์™€ ๊ฐ™์€ ์ฐจ์ด๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

  • shell : ์‹คํ–‰ํ•˜๊ณ ์ž ํ•˜๋Š” shell์„ hdfs์— ์ ์žฌํ•ด์•ผ ํ•˜๋ฏ€๋กœ, shell ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋Š” ๋…ธ๋“œ๋Š” randomํ•˜๊ฒŒ ์ง€์ •๋ฉ๋‹ˆ๋‹ค.
  • ssh : shell์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๋…ธ๋“œ๋ฅผ ์ž„์˜๋กœ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ssh ๋…ธ๋“œ ์‹คํ–‰์„ ์œ„ํ•ด์„œ password-less ์„ค์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.