반응형

0. 설치 파일 다운로드

 

https://redis.io/download  사이트에서 Stable된 파일을 받는다.

 

1. Redis 설치

 

[root@CMaria ~]# ls

redis-4.0.6.tar.gz

[root@CMaria ~]# tar xvfz redis-4.0.6.tar.gz

[root@CMaria ~]# ls

redis-4.0.6  redis-4.0.6.tar.gz

[root@CMaria ~]# cd redis-4.0.6

[root@CMaria redis-4.0.6]# pwd

/root/redis-4.0.6

[root@CMaria redis-4.0.6]# make

.....

Hint: It's a good idea to run 'make test' ;)

 

[root@CMaria redis-4.0.6]# make install

cd src && make install

make[1]: Entering directory `/root/redis-4.0.6/src'

    CC Makefile.dep

make[1]: Leaving directory `/root/redis-4.0.6/src'

make[1]: Entering directory `/root/redis-4.0.6/src'

 

Hint: It's a good idea to run 'make test' ;)

 

    INSTALL install

    INSTALL install

    INSTALL install

    INSTALL install

    INSTALL install

make[1]: Leaving directory `/root/redis-4.0.6/src'

 

2. Redis 실행/종료

 

[root@localhost ~]# /root/redis-stable/src/redis-server  /root/redis-stable/redis.conf &

[1] 2321

[root@localhost ~]# 2321:C 26 Dec 19:36:25.375 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

2321:C 26 Dec 19:36:25.375 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=2321, just started

2321:C 26 Dec 19:36:25.375 # Configuration loaded

2321:M 26 Dec 19:36:25.376 * Increased maximum number of open files to 10032 (it was originally set to 1024).

                _._

           _.-``__ ''-._

      _.-``    `.  `_.  ''-._           Redis 4.0.6 (00000000/0) 64 bit

  .-`` .-```.  ```\/    _.,_ ''-._

 (    '      ,       .-`  | `,    )     Running in standalone mode

 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

 |    `-._   `._    /     _.-'    |     PID: 2321

  `-._    `-._  `-./  _.-'    _.-'

 |`-._`-._    `-.__.-'    _.-'_.-'|

 |    `-._`-._        _.-'_.-'    |           http://redis.io

  `-._    `-._`-.__.-'_.-'    _.-'

 |`-._`-._    `-.__.-'    _.-'_.-'|

 |    `-._`-._        _.-'_.-'    |

  `-._    `-._`-.__.-'_.-'    _.-'

      `-._    `-.__.-'    _.-'

          `-._        _.-'

              `-.__.-'

 

2321:M 26 Dec 19:36:25.380 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

2321:M 26 Dec 19:36:25.380 # Server initialized

2321:M 26 Dec 19:36:25.380 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

2321:M 26 Dec 19:36:25.380 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

2321:M 26 Dec 19:36:25.477 * DB saved on disk

2321:M 26 Dec 19:36:25.478 * DB loaded from append only file: 0.098 seconds

2321:M 26 Dec 19:36:25.478 * Ready to accept connections

 

 

[root@localhost ~]# ps -ef | grep redis

root      2321  2198  0 19:36 pts/0    00:00:00 /root/redis-stable/src/redis-server 0.0.0.0:6379

root      2329  2198  0 19:41 pts/0    00:00:00 grep --color=auto redis

[root@localhost ~]#

[root@localhost ~]# /root/redis-stable/src/redis-cli shutdown

2321:M 26 Dec 19:41:42.345 # User requested shutdown...

2321:M 26 Dec 19:41:42.345 * Calling fsync() on the AOF file.

2321:M 26 Dec 19:41:42.382 * Saving the final RDB snapshot before exiting.

2321:M 26 Dec 19:41:42.424 * DB saved on disk

2321:M 26 Dec 19:41:42.424 * Removing the pid file.

2321:M 26 Dec 19:41:42.424 # Redis is now ready to exit, bye bye...

[1]+  Done                    /root/redis-stable/src/redis-server /root/redis-stable/redis.conf


[root@localhost ~]# ps -ef | grep redis

root      2332  2198  0 19:41 pts/0    00:00:00 grep --color=auto redis

 

 

3. 하나의 서버에서 포트를 다르게 해서 Redis 인스턴스 하나더 기동 시키기

 

설정 파일을 하나더 만들어서 포트/디렉토리 정보만 변경해서 기동 시키면 새로 기동 시킬 Redis 포트는 6380 이고,

로그 파일의 경로는 /root/redis-stable6380으로 설정 예정임

 

1. 설정 파일 복사 수정

 

[root@localhost ~]# mkdir /root/redis-stable6380

[root@localhost ~]# ls

redis-stable  redis-stable6380  redis-stable.tar.gz

[root@localhost ~]# cp /root/redis-stable/redis.conf  /root/redis-stable6380/redis-stable6380/.

 

2. 설정 파일 편집

기본적으로 다음의 4 설정 편집.

pidfile /var/run/redis_6380.pid

port 6380

logfile /var/log/redis/redis_6380.log

dir /var/lib/redis/6380

 

3. 레디스 기동

 

[root@localhost redis-stable6380]# /root/redis-stable/src/redis-server /root/redis-stable6380/redis.conf &

 

[root@localhost ~]# ps -ef | grep redis

root      2334  2198  0 19:47 pts/0    00:00:00 /root/redis-stable/src/redis-server 0.0.0.0:6380

root      2340  2198  0 19:47 pts/0    00:00:00 /root/redis-stable/src/redis-server 0.0.0.0:6379

 

4. 레디스 접속

 

[root@localhost ~]# /root/redis-stable/src/redis-cli -p 6380

 

127.0.0.1:6380> info server

# Server

redis_version:4.0.6

redis_git_sha1:00000000

redis_git_dirty:0

redis_build_id:985e3df2745c74e9

redis_mode:standalone

os:Linux 3.10.0-514.el7.x86_64 x86_64

arch_bits:64

multiplexing_api:epoll

atomicvar_api:atomic-builtin

gcc_version:4.8.5

process_id:2334

run_id:67f4569af1ea4f6127c7a2ba723db9e55272cda3

tcp_port:6380

uptime_in_seconds:61

uptime_in_days:0

hz:10

lru_clock:4386255

executable:/root/redis-stable/src/redis-server

config_file:/root/redis-stable6380/redis.conf

 

5. 레디스 종료

 

[root@localhost ~]# /root/redis-stable/src/redis-cli -p 6380 shutdown

 

 

 

반응형

+ Recent posts