728x90
Redis 기동
$ redis-server &
# 정상 기동시 아래와 같은 로그가 확인 됨
23065:M 08 Jun 2023 00:54:10.068 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 7.0.11 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 23065
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
23065:M 08 Jun 2023 00:54:10.070 # Server initialized
Redis 기동 확인
ps -ef | grep redis
root 23065 910 0 00:54 pts/0 00:00:00 redis-server *:6379
Redis CLI 접속 확인
$ redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> exit
Redis 종료
$ redis-cli shutdown
23065:M 08 Jun 2023 00:58:42.755 # User requested shutdown...
23065:M 08 Jun 2023 00:58:42.755 * Saving the final RDB snapshot before exiting.
23065:M 08 Jun 2023 00:58:42.756 * DB saved on disk
23065:M 08 Jun 2023 00:58:42.756 # Redis is now ready to exit, bye bye...
[1]+ Done redis-server
Redis Service 등록
Ubuntu
- redis.service 생성
$ cd /etc/systemd/system
$ vi redis.service
# redis.service 내용
[Unit]
Description=redis
After=network.target syslog.target
[Service]
User=root
Group=root
ExecStart=/root/redis-7.0.11/bin/redis-server
ExecStop=/root/redis-7.0.11/bin/redis-cli shutdown
RestartSec=10
Restart=on-failure
[Install]
WantedBy=multi-user.target
- 서비스 등록
$ systemctl daemon-reload
$ systemctl enable redis.service
- 서비스 기동 및 종료
# 기동
$ systemctl start redis.service
# 종료
$ systemctl stop reids.service
- 서비스 해제
$ systemctl disable redis.service
Linux
- Root에서 작업 진행
$ cd /usr/lib/system/system/
$ vi redis.service
# redis.service 내용
[Unit]
Description=redis
After=network.target syslog.target
[Service]
User=root
Group=root
ExecStart=/root/redis-7.0.11/bin/redis-server
ExecStop=/root/redis-7.0.11/bin/redis-cli shutdown
RestartSec=10
Restart=on-failure
[Install]
WantedBy=multi-user.target
- 서비스 등록
$ systemctl daemon-reload
$ systemctl enable redis.service
- 서비스 기동 및 종료
# 기동
$ systemctl start redis.service
# 종료
$ systemctl stop reids.service
- 서비스 해제
$ systemctl disable redis.service
728x90
'DataBase > Redis' 카테고리의 다른 글
Redis 설정(GENERAL) (0) | 2023.07.12 |
---|---|
Redis 설정(NetWork) (0) | 2023.07.12 |
Benchmark (0) | 2023.07.10 |
Redis 클러스터 (0) | 2023.07.10 |
Redis 설치 (0) | 2023.06.08 |