当前位置:网站首页>Redis installation

Redis installation

2022-07-06 02:26:00 Flying rookie uncle

One 、 Stand-alone version - 6.2.6

1. Default profile

  • official redis Of docker There is no configuration file in ,redis The configuration takes the default value
docker search redis
docker pull redis
docker run -p 6380:6379 --name erick_redis -d redis
#  View the current redis Version of 
docker exec -it erick_redis redis-server -v
#  Get into redis
docker exec -it erick_redis bash
#  Get into redis Command line of 
redis-cli
#  sign out redis Instruction line , Or quit redis Containers 
exit

2. Custom configuration files

  • redis Officially download one redis, And will redis Below redis.conf Copy the file out
  • Customize and modify the file , Mount the container data volume to redis Medium docker in
bind 127.0.0.1 ::1   #  Limit redis Locally accessible only ,  The line must be commented out 
protected-mode no    #  Default yes, Turn on the protection mode , Limited to local access ;
daemonize no         #  Default no, Change it to yes Will cause profile mode to start redis Failure ;
databases 10         #  The default is 16, You can change to 10 Verify whether the configuration file is effective 
# 1. mac The console uploads files to centos Server opt file 
scp redis.conf [email protected]:/opt/
# 2.  Mount the configuration file in the host to  docker Medium redis, In this way, there will be a redis.conf  file 
docker run -v /opt:/usr/local/etc/redis -p 6381:6379  -d --name szredis redis redis-server /usr/local/etc/redis/redis.conf
# /opt:/usr/local/etc/redis: opt Is equipped with redis.conf  Host Directory of the file 
# /usr/local/etc/redis/redis.conf:  There will be this in the newly generated container redis This directory , If it is not configured, there will be no  
原网站

版权声明
本文为[Flying rookie uncle]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140022280140.html

随机推荐