๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ’ปTech160

[Java] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๊ฒŒ์ž„ ๋งต ์ตœ๋‹จ๊ฑฐ๋ฆฌ ๐Ÿ“„ ๋ฌธ์ œ ๊ฒŒ์ž„ ๋งต ์ตœ๋‹จ๊ฑฐ๋ฆฌ ๐Ÿ’ก ํ’€์ด BFS(๋„ˆ๋น„ ์šฐ์„  ํƒ์ƒ‰) ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๋งต์„ ํ†ต๊ณผ ๊ฐ€๋Šฅํ•œ ๋ฐฉ์•ˆ๋“ค์„ ํƒ์ƒ‰ํ•˜๊ณ , ์ตœ๋‹จ ๊ฑฐ๋ฆฌ๋ฅผ ์ฐพ์•„ answer ๋ณ€์ˆ˜์— ์ €์žฅํ•œ ํ›„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. import java.util.*; class Solution { public int solution(int[][] maps) { int answer = 0; int n = maps.length; int m = maps[0].length; // ์ด๋™ ๊ฐ€๋Šฅํ•œ ๋ฐฉํ–ฅ (์ƒ,ํ•˜,์šฐ,์ขŒ) int[][] directions = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; Queue queue = new LinkedList(); queue.offer(new int[]{0, 0, 1}); // ์‹œ์ž‘ ์œ„์น˜ (0, 0)์—์„œ ์ถœ.. 2023. 9. 28.
[SOLVED] datanode denied communication with namenode because hostname cannot be resolved ๐Ÿšซ ERROR datanode denied communication with namenode because hostname cannot be resolved ๐Ÿ’ก SOLVED DNS ์„ค์ •์œผ๋กœ ๋ณ„๋„๋กœ /etc/hosts ์ž‘์—…์„ ์•ˆํ–ˆ๊ณ , ํ™•์ธํ•ด๋ณด๋‹ˆ ์—ญ๋ฐฉํ–ฅ DNS ๋“ฑ๋ก์ด ์•ˆ๋ผ์„œ ๋ฐœ์ƒํ•œ ๋ฌธ์ œ /etc/hosts์— FQDN ๋“ฑ๋ก ์ž‘์—…์œผ๋กœ ๋ฐ”๋กœ ๋ฌธ์ œ ํ•ด๊ฒฐ 2023. 9. 27.
[Java] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๋„คํŠธ์›Œํฌ ๐Ÿ“„ ๋ฌธ์ œ ๋„คํŠธ์›Œํฌ ๐Ÿ’ก ํ’€์ด DFS(๊นŠ์ด ์šฐ์„  ํƒ์ƒ‰) ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๋„คํŠธ์›Œํฌ๋ฅผ ํƒ์ƒ‰ํ•˜๊ณ , ์—ฐ๊ฒฐ๋œ ๊ทธ๋ฃน์„ ์ฐพ์•„ answer ๋ณ€์ˆ˜์— ์ €์žฅํ•œ ํ›„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. class Solution { public int solution(int n, int[][] computers) { boolean[] visited = new boolean[n]; // ์ปดํ“จํ„ฐ ๋ฐฉ๋ฌธ ์—ฌ๋ถ€๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฐฐ์—ด int answer = 0; // ๋„คํŠธ์›Œํฌ ๊ฐœ์ˆ˜๋ฅผ ์„ธ๋Š” ๋ณ€์ˆ˜ for (int i = 0; i < n; i++) { if (!visited[i]) { // ์•„์ง ๋ฐฉ๋ฌธํ•˜์ง€ ์•Š์€ ์ปดํ“จํ„ฐ๋ผ๋ฉด dfs(i, computers, visited); // DFS๋กœ ์—ฐ๊ฒฐ๋œ ๋ชจ๋“  ์ปดํ“จํ„ฐ๋ฅผ ๋ฐฉ๋ฌธ answer++; // ๋„คํŠธ์›Œํฌ ๊ฐœ์ˆ˜ ์ฆ๊ฐ€ } } return.. 2023. 9. 26.
[Java] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ํƒ€๊ฒŸ ๋„˜๋ฒ„ ๐Ÿ“„ ๋ฌธ์ œ ํƒ€๊ฒŸ ๋„˜๋ฒ„ ๐Ÿ’ก ํ’€์ด ๊นŠ์ด ์šฐ์„  ํƒ์ƒ‰ (DFS)์„ ํ™œ์šฉํ•˜์—ฌ ์ฃผ์–ด์ง„ ์ˆซ์ž ๋ฐฐ์—ด์—์„œ ๊ฐ ์ˆซ์ž๋ฅผ ๋”ํ•˜๊ฑฐ๋‚˜ ๋นผ์„œ ํŠน์ • ๋ชฉํ‘œ ์ˆซ์ž(target)๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ์˜ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. class Solution { private int answer = 0; public int solution(int[] numbers, int target) { dfs(numbers, target, 0, 0); return answer; } private void dfs(int[] numbers, int target, int index, int currentSum) { if (index == numbers.length) { // ๋ฐฐ์—ด์˜ ๋๊นŒ์ง€ ๋„๋‹ฌํ•œ ๊ฒฝ์šฐ, ํ˜„์žฌ ํ•ฉ์ด ํƒ€๊ฒŸ๊ณผ ์ผ์น˜ํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  answer๋ฅผ ์—…๋ฐ์ด.. 2023. 9. 25.
Apache Ranger ์‚ฌ์šฉ๋ฒ• Ranger Web UI ๊ฐ ๊ธฐ๋Šฅ๋“ค ์‚ฌ์šฉ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. Ranger๋ž€? ํ•˜๋‘ก ์ „์ฒด ์„œ๋น„์Šค์— ๋Œ€ํ•œ ๋ณด์•ˆ ์ •์ฑ…์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ๊ณ  ๊ด€๋ฆฌ ๋ฐ ์šด์˜ํ•  ์ˆ˜ ์žˆ๋Š” Hadoop Component ํ•˜๋‘ก์˜ ๋ณด์•ˆ ๊ด€๋ จ ์กฐ์น˜๋Š” ๋Œ€๋ถ€๋ถ„ Ranger์—์„œ ์ฒ˜๋ฆฌ ๊ฐ€๋Šฅํ•˜๋‹ค๊ณ  ๋ณด์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. Ranger Architecture Ranger๋Š” Hadoop์˜ ์ „์ฒด ์ปดํฌ๋„ŒํŠธ์— ๋Œ€ํ•œ Ranger ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํ™œ์„ฑํ™”ํ•˜์—ฌ ๋ชจ๋“  ์•ก์„ธ์Šค๋ฅผ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Ranger ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ Ranger policy server ๊ฐ„์—๋Š” ์–‘๋ฐฉํ–ฅ ํ†ต์‹ ์ด ์ด๋ฃจ์–ด์ง€๋ฉฐ, Ranger ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ์ •๊ธฐ์ ์œผ๋กœ(30์ดˆ) Ranger Policy Server๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์ƒˆ๋กœ์šด ์ •์ฑ…์ด ์ •์˜๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ”— https://doc.hcs.huawei.com/productdesc/.. 2023. 8. 23.
[NiFi] ExecuteSQLRecord postgresql ์‚ฌ์šฉ์‹œ ์ฃผ์˜ auto commit ์˜ต์…˜์ด default๋กœ true์ธ๋ฐ postgresql ๊ฐ™์€ ๊ฒฝ์šฐ true๋กœ ์‚ฌ์šฉ ์‹œ, Heavy Query ์ผ ๊ฒฝ์šฐ ๋ชจ๋‘ ๋ฉ”๋ชจ๋ฆฌ์— ์˜ฌ๋ ค์„œ ๊ฐ€์ ธ์˜ค๊ธฐ ๋•Œ๋ฌธ์— nifi ์žฅ์•  ๋ฐœ์ƒ๋จ (nifi ํ”„๋กœ์„ธ์Šค kill ํ•ด์ค˜์•ผ ํ•จ) ๊ฒฐ๋ก ์€ postgresql์€ auto commit ์˜ต์…˜์„ false๋กœ ์„ค์ •ํ•˜๊ณ  fetch ์‚ฌ์ด์ฆˆ๋ฅผ ํ• ๋‹นํ•ด์„œ ๋ฉ”๋ชจ๋ฆฌ ์ด์Šˆ๋ฅผ ์˜ˆ๋ฐฉํ•  ์ˆ˜ ์žˆ์Œ 2023. 8. 22.
[๋ฆฌ๋ˆ…์Šค] ulimit ์„ค์ •ํ•˜์—ฌ ์„ฑ๋Šฅ ์ œํ•œ ํ•ด์ œ open file๊ณผ process ์ƒ์„ฑ ์ œํ•œ ๊ด€๋ จ ์˜ˆ์™ธ ๋ฐœ์ƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์„ค์ •ํ•ด์ค๋‹ˆ๋‹ค. โ—พ limit values ์ˆ˜์ • vi /etc/security/limits.conf ------------------------------ * - nofile 65536 * - nproc 65536 ------------------------------ (- : soft, hard ๋™์ผํ•˜๊ฒŒ ์ ์šฉ) โ—พ ulimit ์กฐํšŒ ๋ช…๋ น์–ด ulimit -a ----------------------------------------- open files (-n) 65536 max user processes (-u) 65536 2023. 8. 21.
[๋ฆฌ๋ˆ…์Šค] ssh ํŒจ์Šค์›Œ๋“œ ์ž…๋ ฅ์—†์ด ์ ‘์† (passwordless) ๋ฆฌ๋ˆ…์Šค์—์„œ ํŒจ์Šค์›Œ๋“œ ์ž…๋ ฅ ์—†์ด ssh ์ ‘์†ํ•˜๋Š” 2๊ฐ€์ง€ ๋ฐฉ๋ฒ• ์ •๋ฆฌํ•ฉ๋‹ˆ๋‹ค. 1. ํŒจ์Šค์›Œ๋“œ ์ž…๋ ฅ ์—†์ด ์ ‘์†ํ•  ์„œ๋ฒ„์— ์•”ํ˜ธํ™” ํ‚ค๋ฅผ ๋“ฑ๋กํ•˜์—ฌ ์ž๋™๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค. โ—พ rsa ํ‚ค ์ƒ์„ฑ์ด ์•ˆ๋˜์žˆ์„ ๊ฒฝ์šฐ ์ƒ์„ฑํ•ด ์ค๋‹ˆ๋‹ค. ssh-keygen -t rsa Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): ## ()๊ด„ํ˜ธ ์œ„์น˜๋กœ ์‚ฌ์šฉํ•  ๊ฑฐ๋ฉด Enter Enter passphrase (empty for no passphrase): ## ํŒจ์Šค์›Œ๋“œ ์—†์ด ์‚ฌ์šฉํ•  ๊ฑฐ๋ฉด Enter Enter same passphrase again: ## Enter โ—พ authorized_keys ํŒŒ์ผ์ด ์—†์œผ๋ฉด ์ƒ์„ฑํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. chmod 700 ~/.ssh ## 700์œผ๋กœ ๊ถŒํ•œ ๋ณ€๊ฒฝ cd.. 2023. 8. 21.