Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- OD
- autovacuum
- NOSQL
- Replication
- InnoDB
- Connection
- Maria
- DML
- vacuum
- 6.2.7
- maxclients
- slack
- jmeter
- RDS
- postgresql
- 성능테스트
- zabbix
- MyISAM
- Docker
- ncloud
- mysql
- cdb
- opensource
- Cloud DB for MySQL
- ROLLBACK
- NCP
- RDBMS
- REDIS
- mongo
- online ddl
Archives
- Today
- Total
개인 공부
[Redis] Redis 설치 본문
반응형
많은 회사들이Database cache server용으로 Redis를 이용한다는 말을 듣고 Redis에 대해 공부해보기로 하였다.
오늘은 간단한 Redis 설치 과정에대해 포스팅해야지..
1. Redis란? |
- 레디스는 Key-Value 구조의 비정형 데이터를 저장하고 관리하기 위한 Opensource 비 관계형 데이터베이스이다.
- 레디스는 모든 데이터를 메모리에 로드해 처리하는 메모리 기반 DBMCS이다.
- 데이터 구조로는 String / List / Set / Sorted Set / Hashes를 지원하고 있다.
- 많은회사에서 사용되고있으며 안전성 이나 성능면에서 검증된 Database이다.
2. Redis 설치 |
1) 패키지 설치
- Redis를 설치하기전에 Compile할시 필요한 패키지 설치
sudo yum -y install gcc-c++ |
2) THP 설정
- REDIS에서는 Hugepage를 Disable시킬것을 권장하고있다. 재부팅 시 설정을 변경하기 위해 /etc/rc.local 에도 명령어를 추가해 준다.
[root@redis ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled [root@redis ~]# vi /etc/rc.local echo never > /sys/kernel/mm/transparent_hugepage/enabled [root@redis ~]# cat /proc/meminfo | grep AnonHugePages AnonHugePages: 0 kB |
3) 다운로드 및 설치
- 공식 사이트에서 안정된 Stable 버전을 받을수있다. ( https://redis.io/download )
[root@redis ~]# wget http://download.redis.io/releases/redis-3.2.8.tar.gz [root@redis ~]# tar -zxvf redis-3.2.8.tar.gz [root@redis ~]# cd redis-3.2.8/ [root@redis redis-3.2.8]# make [root@redis redis-3.2.8]# make install [root@redis ~]# cd /root/redis-3.2.8/utils/ [root@redis utils]# ./install_server.sh Welcome to the redis service installer This script will help you easily set up a running redis server Please select the redis port for this instance: [6379] Selecting default: 6379 Please select the redis config file name [/etc/redis/6379.conf] Selected default - /etc/redis/6379.conf Please select the redis log file name [/var/log/redis_6379.log] Selected default - /var/log/redis_6379.log Please select the data directory for this instance [/var/lib/redis/6379] Selected default - /var/lib/redis/6379 Please select the redis executable path [/usr/local/bin/redis-server] Selected config: Port : 6379 Config file : /etc/redis/6379.conf Log file : /var/log/redis_6379.log Data dir : /var/lib/redis/6379 Executable : /usr/local/bin/redis-server Cli Executable : /usr/local/bin/redis-cli Is this ok? Then press ENTER to go on or Ctrl-C to abort. Copied /tmp/6379.conf => /etc/init.d/redis_6379 Installing service... Successfully added to chkconfig! Successfully added to runlevels 345! Starting Redis server... Installation successful! [root@redis utils]# ps -ef | grep redis | grep -v grep root 1433 1 0 04:49 ? 00:00:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-b4dc3c6e-991a-48bf-903d-44682e63916e-ens3.lease -pf /var/run/dhclient-ens3.pid -H redis ens3 root 11993 1 0 05:10 ? 00:00:00 /usr/local/bin/redis-server 127.0.0.1:6379 |
4.Redis 접속 & 간단 TEST
-redis에 접속하여 간단한 key-value 셋팅과 조회해보자
[root@redis utils]# redis-cli 127.0.0.1:6379> ping PONG 127.0.0.1:6379> set name lee OK 127.0.0.1:6379> get name "lee" |
5.Redis 외부 접속 & 패스워드 설정
- 기본적으로 redis는 127.0.0.1(localhost)에서만 접속되게 되어잇고 Password가 설정되어있지 않다
127.0.0.1:6379> shutdown 10980:M 30 Sep 06:17:26.787 # User requested shutdown... 10980:M 30 Sep 06:17:26.787 * Saving the final RDB snapshot before exiting. 10980:M 30 Sep 06:17:26.789 * DB saved on disk 10980:M 30 Sep 06:17:26.789 # Redis is now ready to exit, bye bye... not connected> exit [1]+ Done redis-server [root@redis ~]# vi /etc/redis/6379.conf --> bind / requirepass 값 변경 bind 0.0.0.0 requirepass test [root@redis ~]# /etc/init.d/redis_6379 start [root@redis ~]# ps -ef | grep redis root 1433 1 0 04:49 ? 00:00:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-b4dc3c6e-991a-48bf-903d-44682e63916e-ens3.lease -pf /var/run/dhclient-ens3.pid -H redis ens3 root 11629 1 0 06:22 ? 00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379 [root@redis ~]# redis-cli 127.0.0.1:6379> ping (error) NOAUTH Authentication required. --> 인증을 하지 않아서 Error 발생 127.0.0.1:6379> auth test --> auth [password] OK 127.0.0.1:6379> ping PONG --> 인증후 성공하는것을 볼 수 있다. [root@redis ~]# redis-cli -h 10.0.3.245 -a test --> cli로 들어갈때 Password를 입력해서 들어갈수도있다. 10.0.3.245:6379> ping PONG |
3. 참고 |
반응형
'Redis' 카테고리의 다른 글
[ REDIS ] max number of clients reached 이슈 (0) | 2025.01.08 |
---|---|
Redis 6 Download & Install (1) | 2023.12.20 |
Redis Migration (1) | 2023.12.08 |
Redis - Maxmemory (0) | 2022.02.22 |
[Redis] Redis Cache Server 만들기! (0) | 2021.10.05 |