Redis 개요 및 Liux 설치 redis 의 상세 한 튜 토리 얼

1.레 디 스 는 무엇 입 니까?
  • 의 성능 이 매우 높 고 레 디 스 가 읽 을 수 있 는 속 도 는 110000 회/s 이 며 쓴 속 도 는 81000 회/s 이다.
  • Redis 는 데이터 의 지속 성 을 지원 하 며 메모리 에 있 는 데 이 터 를 디스크 에 유지 하고 재 부팅 할 때 다시 불 러 와 사용 할 수 있 습 니 다.
  • Redis 는 간단 한 key-value 형식의 데 이 터 를 지원 할 뿐만 아니 라 list,set,zset,hash 등 데이터 구조의 저장 도 제공 합 니 다.
  • Redis 는 데이터 백업,즉 master-slave 모드 의 데이터 백업 을 지원 합 니 다.
  • 2.Redis 특징
  • 의 성능 이 매우 높 고 레 디 스 가 읽 을 수 있 는 속 도 는 110000 회/s 이 며 쓴 속 도 는 81000 회/s 이다.
  • Redis 는 데이터 의 지속 성 을 지원 하 며 메모리 에 있 는 데 이 터 를 디스크 에 유지 하고 재 부팅 할 때 다시 불 러 와 사용 할 수 있 습 니 다.
  • Redis 는 간단 한 key-value 형식의 데 이 터 를 지원 할 뿐만 아니 라 list,set,zset,hash 등 데이터 구조의 저장 도 제공 합 니 다.
  • Redis 는 데이터 백업,즉 master-slave 모드 의 데이터 백업 을 지원 합 니 다.
  •  3.레 디 스 는 무엇 을 할 수 있 습 니까?
  •  메모리 저장 및 지속 화:redis 는 메모리 에 있 는 데 이 터 를 하 드 디스크 에 기록 하 는 동시에 서비스 에 영향 을 주지 않 습 니 다.
  • 에서 최신 N 개의 데 이 터 를 가 져 오 는 동작 입 니 다.예 를 들 어 최신 10 개의 댓 글 ID 를 Redis 의 List 집합 에 넣 을 수 있 습 니 다.
  • 시 뮬 레이 션 은 HttpSession 과 같은 만 료 시간 을 설정 해 야 하 는 기능 입 니 다.
  • 게시,구독 메시지 시스템
  •  4.redis 설치
    중국어 공식 사이트:Http://www.redis.cn/
    기업 내 에서 레 디 스 개발 을 하 는데 99%가 리 눅 스 버 전의 운용 과 설치 이다.
    첫 번 째 다운로드 redis
    wget http://download.redis.io/releases/redis-4.0.6.tar.gz
    在这里插入图片描述
    두 번 째 압축 풀기 패키지
    tar -zxvf redis-4.0.6.tar.gz
    
    [root@iZwz991stxdwj560bfmadtZ local]# tar -zxvf redis-4.0.6.tar.gz
    3 단계 yum 설치 gcc 의존
    yum install gcc
    
    [root@iZwz991stxdwj560bfmadtZ local]# yum install gcc
    선택 이 있 으 면 y 를 입력 하면 됩 니 다.
    네 번 째 단 계 는 redis 압축 해제 디 렉 터 리 로 넘 어 갑 니 다.
    cd redis-4.0.6
    
    [root@iZwz991stxdwj560bfmadtZ local]# cd redis-4.0.6
    5 단계 컴 파일 설치
    make MALLOC=libc
    
    [root@iZwz991stxdwj560bfmadtZ redis-4.0.6]# make MALLOC=libc
    /usr/local/redis-4.0.6/src 디 렉 터 리 에 있 는 파일 을/usr/local/bin 디 렉 터 리 에 추가 합 니 다.
    cd src && make install
    
    [root@iZwz991stxdwj560bfmadtZ redis-4.0.6]# cd src && make install
     CC Makefile.dep
    
    Hint: It's a good idea to run 'make test' ;)
    
     INSTALL install
     INSTALL install
     INSTALL install
     INSTALL install
     INSTALL install
    5.redis 시작
    리 디 스 를 직접 시작 하 는 방식
    ./redis-server
    
    [root@iZwz991stxdwj560bfmadtZ src]# ./redis-server
    18685:C 13 Dec 12:56:12.507 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    18685:C 13 Dec 12:56:12.507 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=18685, just started
    18685:C 13 Dec 12:56:12.507 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
        _._             
       _.-``__ ''-._            
      _.-`` `. `_. ''-._   Redis 4.0.6 (00000000/0) 64 bit
     .-`` .-```. ```\/ _.,_ ''-._         
     ( '  ,  .-` | `, )  Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|  Port: 6379
     | `-._ `._ /  _.-' |  PID: 18685
     `-._ `-._ `-./ _.-' _.-'         
     |`-._`-._ `-.__.-' _.-'_.-'|         
     | `-._`-._  _.-'_.-' |   http://redis.io  
     `-._ `-._`-.__.-'_.-' _.-'         
     |`-._`-._ `-.__.-' _.-'_.-'|         
     | `-._`-._  _.-'_.-' |         
     `-._ `-._`-.__.-'_.-' _.-'         
      `-._ `-.__.-' _.-'          
       `-._  _.-'           
        `-.__.-'            
    
    18685:M 13 Dec 12:56:12.508 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    18685:M 13 Dec 12:56:12.508 # Server initialized
    18685:M 13 Dec 12:56:12.508 # 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.
    18685:M 13 Dec 12:56:12.508 # 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.
    18685:M 13 Dec 12:56:12.508 * Ready to accept connections 
    위의 그림:redis 시작 에 성 공 했 지만 이 시작 방식 은 창 을 계속 열 어야 합 니 다.다른 작업 을 할 수 없어 서 불편 합 니 다.
    ctrl+c 를 누 르 면 창 을 닫 을 수 있 습 니 다.
    방식 2 이후 데스크 톱 프로 세 스 방식 으로 redis 시작
    첫 번 째 단계:redis.conf 파일 수정
    장차
    
    daemonize no
    으로 변경
    
    daemonize yes
    두 번 째 단계:redis.conf 파일 시작 지정
    
    redis-server /usr/local/redis-4.0.6/redis.conf
    
    ps -aux | grep redis  redis  
    在这里插入图片描述
    이렇게 redis 가 Liux 에 설치 되 었 습 니 다.
    6.redis 의 helloworld
    在这里插入图片描述
    여기 서 Redis 개술 및 Liux 설치 redis 에 관 한 상세 한 튜 토리 얼 에 관 한 글 은 여기까지 소개 되 었 습 니 다.더 많은 Liux 설치 redis 내용 은 예전 의 글 을 검색 하거나 아래 의 관련 글 을 계속 조회 하 시기 바 랍 니 다.앞으로 저 희 를 많이 사랑 해 주세요!

    좋은 웹페이지 즐겨찾기