๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

๋ฆฌ๋ˆ…์Šค5

[Linux] OOM Killer๋ž€? Kill ๋Œ€์ƒ์—์„œ ์ œ์™ธ์‹œํ‚ค๊ธฐ ํšŒ์‚ฌ์—์„œ ๋‹ค๋ฅธ ํŒ€๋“ค๊ณผ ๊ณต์šฉ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ์„œ๋ฒ„๊ฐ€ ์žˆ๋Š”๋ฐ ์ž๊พธ ์ด์œ ์—†์ด ๋ฌด์ž‘์œ„๋กœ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ฃฝ๋Š” ํ˜„์ƒ์ด ๋ฐœ์ƒํ–ˆ๋‹ค. ๊ฐ ํ”„๋กœ์ ํŠธ์˜ ๋กœ๊ทธ๋ฅผ ๋ด๋„ ํŠน๋ณ„ํ•˜๊ฒŒ ๋‚จ์•„์žˆ๋Š”๊ฒŒ ์—†์—ˆ๊ณ .. ์›์ธ์€ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋ถ€์กฑํ•˜์—ฌ ๋ฆฌ๋ˆ…์Šค ์ปค๋„์ด OOM Killer ์ž‘์—…์„ ์‹คํ–‰ํ•œ ๊ฒƒ! OOM Killer๋ž€ ? OOM : Out of Memory ๋ฉ”๋ชจ๋ฆฌ ๋ถ€์กฑ์‹œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ™•๋ณดํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ์œผ๋กœ ํ”„๋กœ์„ธ์Šค์˜ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น์‹œ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋ถ€์กฑํ•œ ์ƒํ™ฉ์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด linux kernel์ด OOM Killer๋ฅผ ์‹คํ–‰ํ•œ๋‹ค. (์ ์ˆ˜๋ฅผ ๋งค๊ฒจ ๋†’์€ ์ ์ˆ˜๋ฅผ ๋ฐ›์€ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ฃฝ์—ฌ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ™•๋ณดํ•จ) ํ”„๋กœ์„ธ์Šค๋ฅผ ์ข…๋ฃŒ์‹œํ‚ค๋Š” ์ˆœ์œ„ oom_badnesss() ๋ฉ”์†Œ๋“œ์—์„œ ํ”„๋กœ์„ธ์Šค๋ณ„ ์ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•˜์—ฌ ์„ ํƒ OOM Killer๋Š” ์ ์ˆ˜๋ฅผ ๋งค๊ฒจ ๊ฐ€์žฅ ๋†’์€ ์ ์ˆ˜๋ฅผ ๋ฐ›์€ ํ”„๋กœ์„ธ์Šค๋ถ€ํ„ฐ kill.. 2022. 1. 18.
[Linux] netstat ๋ช…๋ น์–ด๋กœ ๋„คํŠธ์›Œํฌ ์ƒํƒœ ํ™•์ธํ•˜๊ธฐ(+ TCP ์ƒํƒœ ์ „์ด) ์„œ๋ฒ„๋ฅผ ์šด์˜ํ•˜๋‹ค๋ณด๋ฉด ๋„คํŠธ์›Œํฌ ์ƒํƒœ๋ฅผ ํ™•์ธํ•ด์•ผํ•  ์ผ์ด ์ƒ๊ธด๋‹ค.. ์šด์˜์ด ์•„๋‹ˆ๋”๋ผ๋„ ๊ฐœ๋ฐœ์ž๋ผ๋ฉด ํ• ์ผ์ด ์ƒ๊ธฐ๋Š”.. netstat๋ž€? ์ „์†ก ์ œ์–ด ํ”„๋กœํ† ์ฝœ, ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”, ์ˆ˜๋งŽ์€ ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค, ๋„คํŠธ์›Œํฌ ํ”„๋กœํ† ์ฝœ ํ†ต๊ณ„๋ฅผ ์œ„ํ•œ ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ์„ ๋ณด์—ฌ์ฃผ๋Š” ๋ช…๋ น ์ค„ ๋„๊ตฌ์ด๋‹ค. (์œ„ํ‚ค๋ฐฑ๊ณผ : https://ko.wikipedia.org/wiki/Netstat) ์‚ฌ์šฉ๋ฐฉ๋ฒ• netstat [์˜ต์…˜] [ | grep ํฌํŠธ๋ฒˆํ˜ธ or ์„œ๋น„์Šค ๋ช…] ์˜ต์…˜ -l (listen) : ์—ฐ๊ฒฐ ๊ฐ€๋Šฅํ•œ ์ƒํƒœ -n (number port) : ํฌํŠธ ๋„˜๋ฒ„ -t (tcp) : tcp -u (udp) : udp -p : ํ”„๋กœ๊ทธ๋žจ ์ด๋ฆ„ / PID -a : ๋ชจ๋‘ -i : ์ด๋”๋„ท ์นด๋“œ๋ณ„ ์ •์ƒ/์—๋Ÿฌ/๋“œ๋ž ์†ก์ˆ˜์‹  ํŒจํ‚ท ์ˆ˜ ํ™•์ธ -r : ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ” -s .. 2021. 12. 29.
[Linux] ๋ฐฉํ™”๋ฒฝ ์„ค์ •ํ•˜๊ธฐ / ํŠน์ • ํฌํŠธ ๋ฐฉํ™”๋ฒฝ ์˜คํ”ˆ CentOS6 ๊นŒ์ง€๋Š” ๋ฐฉํ™”๋ฒฝ ์„ค์ •์„ ํ•˜๊ธฐ ์œ„ํ•ด์„  iptables์„œ๋น„์Šค๋ฅผ ์žฌ์‹œ์ž‘ํ•˜์—ฌ ๋ฐฉํ™”๋ฒฝ ๊ทœ์น™์„ ์„ค์ •ํ•˜์˜€๊ณ , CentOS7 ๋ถ€ํ„ฐ๋Š” ๋ฐฉํ™”๋ฒฝ์„ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐ๋ชฌ์ธ firewalld๊ฐ€ ์ œ๊ณต๋˜์–ด ๋ณด๋‹ค ์‰ฝ๊ฒŒ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ…์—์„  firewalld์— ๋Œ€ํ•ด ์„ค๋ช…ํ•˜๊ณ ์ž ํ•œ๋‹ค! ๋ฆฌ๋ˆ…์Šค OS ๋ฒ„์ „ ํ™•์ธ ๋ฐฉ๋ฒ• cat /etc/*release* firewalld ์„ค์น˜ yum install firewalld systemctl start firewalld systemctl enable firewalld ๊ธฐ๋ณธ ์„ค์ •์€ /usr/lib/firewalld/์— ์œ„์น˜ํ•˜๊ณ  ์žˆ๋‹ค. ์—ฌ๊ธฐ์„œ zone๊ณผ zone๋ณ„ ํ—ˆ์šฉํ•˜๋Š” ์„œ๋น„์Šค๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ์‹œ์Šคํ…œ ๊ฐœ๋ณ„ ์„ค์ •์€ /etc/firewalld/์— ์œ„์น˜ํ•˜๊ณ  ์žˆ์œผ๋ฉฐ firewalld.conf.. 2021. 12. 22.
[Linux] MySQL DB ๋ฐฑ์—… ์Šคํฌ๋ฆฝํŠธ - ์ž๋™์œผ๋กœ ๋ฐฑ์—…ํ•˜๊ธฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ž๋™์œผ๋กœ ๋ฐฑ์—…ํ•  ์ˆ˜ ์žˆ๋„๋ก ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž‘์„ฑํ–ˆ๋‹ค. #! /bin/bash # backup directory dir=$(echo /home1/test01/project01/db/backup) # get backup file time and now time customer_BackupFileDate=$(date -r $dir/backup_customer.sql '+%Y-%m-%d %H:%M:%S') customer_BackupFileDateString=$(date -r $dir/backup_customer.sql '+%Y%m%d_%H%M%S') # rename last backup file mv $dir/backup_customer.sql $dir/backup_customer_$cust.. 2021. 12. 17.
[Linux] ๋ฆฌ๋ˆ…์Šค์—์„œ Unix ODBC ์‚ฌ์šฉํ•˜๊ธฐ 1. ๋จผ์ € Unix ODBC๋ฅผ ์„ค์น˜ํ•œ๋‹ค. yum install -y unixODBC-devel ์„ค์น˜ํ•˜๋ฉด .odbc.ini ํŒŒ์ผ์ด ์ƒ์„ฑ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค! .odbic.iniํŒŒ์ผ์„ ์ž‘์„ฑํ•˜๊ธฐ์— ์•ž์„œ mysql db์— ์—ฐ๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด mysql connector๋ฅผ ์„ค์น˜ํ–ˆ๋‹ค. yum install -y mysql-connector-odbc 2. .odbc.ini ์ž‘์„ฑ [db_test] Description = MySQL ODBC 3.51 Driver Driver = /home/test/sw/mariadb-connector-odbc-2.0.15-ga-rhel6-x86_64/lib64/libmaodbc.so Server = x.x.x.x Socket = User = test Password = test Port.. 2021. 12. 16.
728x90
๋ฐ˜์‘ํ˜•