当前位置:网站首页>Install redis

Install redis

2022-07-06 01:39:00 Freezing point contract

Redis install

Install the package to get

  • http://redis.io

  • http://redis.cn/( At home )

ubuntu System installation Redis

sudo apt-get install redis-server

Installation steps

  • install gcc:

    yum install gcc
    sudo apt-get install gcc
    
  • test gcc Is the installation successful

    gcc --version
    
  • download redis.tar.gz To opt Under the table of contents

  • decompression

    tar -zxvf redis.tar.gz
    
  • After decompression, enter Redis Directory using make Command to compile

    make
    
  • If not ready C Language compiling environment ,make Will report a mistake Jemalloc/jemalloc.h: There is no such document

  • Solution : function make distclean

  • install

    make install
    
  • The installation directory :/usr/local/bin

    • redis-benchmark: Performance testing tools , You can run it in your own book , Look at the performance of your book
    • redis-check-aof: Fix the problem AOF file ,rdb and aof Later on
    • redis-check-dump: Fix the problem dump.rdb file
    • redis-sentinel:Redis Cluster use
    • redis-server:Redis Server start command
    • redis-cli: client , Operation entrance

start-up

  • Run the command :redis-server( The front desk starts )

  • Background start : Copy redis.conf Go to other directories

    cp /opt/redis/redis.conf /ect/redis.conf
    
  • Modify the configuration file , Open background startup

    daemonize no -> yes
    
  • Start the service :redis-server /etc/redis.conf

Access the service

  • redis-cli

  • Test whether the connection with the server is normal , Conduct redis-cli, Carry out orders ping, Show pang It means that the connection is unblocked

    ping
    

Close the service

  • redis-cli shutdown Or enter redis-cli Terminal execution shutdown

port 6379 To come from

  • According to the person's name :Merz( Mobile phone keyboard 9 GongGe )
  • redis Default 16 A database , Similar array subscript from 0 Start , Initial default use 0 Signal library
  • Use select dbid To switch databases

Adoption of Technology

  • memcached: Multithreading + lock

  • Redis: A single thread + multiple IO Multiplexing technology

  • memcached Cannot persist data to disk , and redis Sure

原网站

版权声明
本文为[Freezing point contract]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060128538205.html