โ ๊ณต์๋ฌธ์
โฌ๏ธ Redis ์ค์น ์ ์ ์ธ์คํด์ค ์์ฑํ๋ ๋ฐฉ๋ฒ โฌ๏ธ
2023.01.08 - [์ธํ๋ผ/NHN Cloud] - NHN Cloud ์ธ์คํด์ค ์์ฑํ๊ธฐ
์ธ์คํด์ค ํ๊ฒฝ
- OS : CentOS 7.9
- ์ํคํ ์ณ: x86_64
์ค์นํ Redis ๋ฒ์
- redis 7.0.8 (the lastest stable)
1. ์ค์น ๊ณผ์
( 1 / 6 ) ์ธ์คํด์ค์ SSH ๋ฐฉ์์ผ๋ก ์ ์
ssh -i [ํคํ์ด์ด๋ฆ.pem] centos@[ํ๋กํ
IP]
( 2 / 6 ) wget ๋ค์ด๋ก๋
# ์ธํฐ๋ท์ด ๊ฐ๋ฅํ ํ๊ฒฝ์ผ ๊ฒฝ์ฐ
sudo yum install wget
# ์ธํฐ๋ท์ด ๋ถ๊ฐ๋ฅํ ๊ฒฝ์ฐ
# ์ค์นํ ํ์ผ์ ์๋ฒ์ ์
๋ก๋ํด์ ์งํ
( 3 / 6 ) redis ๋ฐ์ด๋๋ฆฌ ๋ฒ์ ์์ถํ์ผ ๋ค์ด๋ก๋
# ์์ ์ ์ธ ์ต์ ๋ฒ์ ์ ๋ํ ์์ค ํ์ผ (๋ฒ์ 7.0.8)
wget https://download.redis.io/redis-stable.tar.gz
( 4 / 6 ) ์์ถํด์
tar -xzvf redis-stable.tar.gz
( 5 / 6 ) make ์คํ
make
๐ก make๋?
- Unix/Linux์ ํฌํจ๋์ด ์๋ ๋ช ๋ น์ด
- ํ์ผ๊ด๋ฆฌ ์ ํธ๋ฆฌํฐ ์ํํธ์จ์ด
- makefile์ด๋ผ๋ ํ์ผ์ ์ฐธ์กฐํด์ ์ปดํ์ผ๋ฌ์ ๋ช
๋ น์ ์ ๋ฌํ๋ฉฐ, makefile์ ๊ธฐ์ ๋ shell ๋ช
๋ น์ด๊ฐ ์์ฐจ์ ์ผ๋ก ์คํ๋๊ฒ ํจ
- gcc ๋ช ๋ น์ด ๋ฑ์ ์ปดํ์ผ๋ฌ ๋ช ๋ น์ด๋ฅผ makefile์ ๊ธฐ์ ํด ๋์ผ๋ฉด ๊ฐ๋ฐ์๋ make ๋ช ๋ น์ด๋ง ์ฌ์ฉํด์ ์ฌ๋ฌ ๋จ๊ณ์ ์ปดํ์ผ ๊ณผ์ ์ ํ๋ฒ์ ์งํํ ์ ์์
- โ๏ธ์ค๋ฅ ๋ฐ์
which: no python3 in (/user/local/bin:/usr/bin:...)
- python3 ์ค์น ์ฌ๋ถ ํ์ธ ํ ์ค์น
# ์ค์น ์ฌ๋ถ ํ์ธ
python3 --version
# ์ค์น ์
-bash: python3: command not found
# ์ค์น
sudo yum install python3
# ์ค์น ํ
Python 3.6.8
- โ๏ธ์ค๋ฅ ๋ฐ์
make[3]: cc: Command not found
- gcc๊ฐ ์์ด์ ๋๋ ์ค๋ฅ์ด๋ฏ๋ก gcc ์ค์น ํ make cleanํ๊ณ ๋ค์ make
# src ์์น์์
sudo yum install gcc
make clean
make
๐ก gcc๋?
Gnu Complier Collection์ ์ค์๋ง๋ก GNU ํ๋ก์ ํธ์ ์ผํ์ผ๋ก ๊ฐ๋ฐ๋์ด ๋๋ฆฌ ์ฐ์ด๊ณ ์๋ ์ปดํ์ผ๋ฌ
- โ๏ธโ๏ธ ๋ค์ ์ค๋ฅ ๋ฐ์
make distclean
make
๐ก make clean ๊ณผ make distclean ์ฐจ์ด
๋ณดํต source complie ๊ณผ์ ์ <์์ถํด์ - configure - make> ์ด๋ค.
make ํ ๊ฒ์ ๋๋๋ฆฌ๊ธฐ ์ํด์๋ make clean์ ํ๋ฉด ๋์ง๋ง,
์ค์ ์ ๋ณ๊ฒฝํด์ configure ์ด์ ์ผ๋ก ๋๋๋ฆฌ๊ธฐ ์ํด์๋ make distclean์ ํ๋ค.
- make clean : ์ด์ ์ ์ปดํ์ผ ํ๋ ๋ด์ฉ์ ์ญ์
- make distclean : tar.gz ๋ฑ ์์ถํ์ผ์ ํ์์ ๋ ์ต์ด ์ํ๋ก ๋๋์๊ฐ
- ์ด๋ฏธ ํ๋ฒ configure ํ๋ค๊ฐ ๋ค์ configure ํ๊ธฐ ์ํด์ ํด๋น ํ์ผ์ ์์ถ ํด์ ํ ๋๋ ํ ๋ฆฌ ๋ด์์ ์ค์ ํ์ผ ๋ฑ์ ์ง์์ผ ํ๋ ๋ณต์กํ ๊ณผ์ ์ ์์์ ์ญ์ ํด์ค
( 6 / 6 ) ๋ค์ด๋ก๋ ๋ฐ์ ์์ถํ์ผ ์ญ์
rm redis-stable.tar.gz
2. ์ค์น ๊ฒฐ๊ณผ
( 1 / 6 ) redis ์๋ฒ ์คํ
cd redis-stable/
src/redis-server
( 2 / 6 ) redis ํด๋ผ์ด์ธํธ ์คํ
์๋ฒ๋ฅผ ์ผ๋ ์ํ์์ ๋ค๋ฅธ ์์์ SSH ์ ์ํด์ redis-cli๋ก ๋์ ์ค์ธ redis ์๋ฒ์ ์ ์
cd redis-stable/
src/redis-cli
( 3 / 6 ) ping ๋ ๋ ค๋ณด๊ธฐ
( 4 / 6 ) strings ์์ฑ
( 5 / 6 ) hashes ์์ฑ
( 6 / 6 ) set key ์์ฑ
๋ถ๋ก) ์ ๊ฑฐ ๋ฐฉ๋ฒ
# 1. ์คํ์ค์ธ ๋ชจ๋ ๋ ๋์ค ์๋ฒ๋ฅผ ์ค๋จ
$ sudo service redis stop
# 2. /usr/local/bin/ ์ ๋ชจ๋ ๊ฒ ์ ๊ฑฐ
$ sudo rm /usr/local/bin/redis-*
# 3. Redis configurations ํด๋ ๋ฐ ๋ด์ฉ ์ ๊ฑฐ
$ sudo rm -r /etc/redis/
# 4. ๋ก๊ทธ ํ์ผ๋ค ์ ๊ฑฐ
$ sudo rm /var/log/redis_*
# 5. Redis data ํด๋ ๋ฐ ๋ด์ฉ ์ ๊ฑฐ
$ sudo rm -r /var/lib/redis/
# 6. Redis init ์คํฌ๋ฆฝํธ ์ ๊ฑฐ
$ sudo rm /etc/init.d/redis_*
# 7. Redis PID ์ ๊ฑฐ
$ sudo rm /var/run/redis_*
์ฐธ๊ณ
http://egloos.zum.com/sweeper/v/3157977
https://dobby-the-house-elf.tistory.com/109
https://m.blog.naver.com/sory1008/221707361845
https://celltwo.tistory.com/89
https://80000coding.oopy.io/d5fa7c87-192f-4c68-95eb-aa4af5b9dbf5