首页 > 数据库 >docker部署redis

docker部署redis

时间:2022-11-13 21:15:12浏览次数:40  
标签:myredis no 部署 max redis docker yes

1、问题描述

docker部署redis,记录下。

2、问题说明

2.1、搜索redis,可跳过

docker search redis

2.2 获取docker镜像

docker pull redis

2.3 构建容器前准备工作,挂载文件夹

mkdir -p /home/redis/myredis

cd /home/redis/myredis
vi myredis.conf

# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#bind 127.0.0.1
protected-mode no
port 6379
tcp-backlog 511
requirepass 000415
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 30
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly yes
appendfilename "appendonly.aof"
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-max-len 128
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes

:wq

2.4 构建容器

docker run --restart=always --log-opt max-size=100m --log-opt max-file=2 -p 6379:6379 --name myredis -v /home/redis/myredis/myredis.conf:/etc/redis/redis.conf -v /home/redis/myredis/data:/data -d redis redis-server /etc/redis/redis.conf  --appendonly yes  --requirepass redis8878x

简要说明:-requirepass redis8878x,数据访问需要密码:redis8878x

2.5 验证

命令验证:

docker exec -it myredis redis-cli

get s1
(error) NOAUTH Authentication required.

auth redis8878x
OK
get s1
(nil)

其他(删除容器)
 docker kill myredis
 docker rm myredis

客户端验证:


更多信息请关注公众号:「软件老王」,关注不迷路,软件老王和他的IT朋友们,分享一些他们的技术见解和生活故事。

标签:myredis,no,部署,max,redis,docker,yes
From: https://www.cnblogs.com/ruanjianlaowang/p/16886943.html

相关文章

  • 【2022.11.11】luffy项目部署(7)
    内容概要1登录注册模态框分析1.1Login.vue1.2Header.vue2登录注册前端页面复制2.0Header.vue2.1Login.vue2.3Register.vue3腾讯短信功能二次封装......
  • Docker Alpine 容器修改/etc/hosts 不生效的问题
     DockerAlpine容器修改/etc/hosts不生效的问题有些团队开的工作开发时喜欢使用修改hosts来绑定开发域名和子域名之间的cookie共享,但是在使用golangapp使用alpine......
  • 【Redis】学习笔记03
    Redis持久化方案bgsave   rdb       rdb持久化方案配置save时间[秒数]发生变化的key数量rdb方案缺点:可能数据会丢失aof开启aof数据持久化方......
  • Dashboard部署
    官网https://kubernetes.io/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard/一、下载资源清单文件上述官网提供的地址无法访问,所以无法直接部署#官......
  • Redis进阶
    1.Redis缓存相关问题1.1缓存穿透缓存穿透是指查询一个数据库一定不存在的数据。我们以前正常的使用Redis缓存的流程大致是:1、数据查询首先进行缓存查询2、如果数据......
  • 部署Kubernetes 1.25.4初始ipvs模式
    1、环境准备主机名IP地址系统版本k8s-master01k8s-master01.wang.org​kubeapi.wang.orgkubeapi192.168.100.201Ubuntu2004k8s-master02k8s-master02.wang.org192.168.1......
  • 全网Tengine最新版本部署及原理(最详细安装过程,坑全部排除,一次成功)
    简单比较一下Tengine和Nginx背景使用最新的软件,可以处理一些bug,文章对CentOS6不做介绍(不会用)推荐使用Tengine,理由是淘宝再用,兼容Nginx可以随时切换Tengine-2.3.0+......
  • 部署argo-rollouts
    https://github.com/argoproj/argo-rollouts/releaseskubectlcreatenamespaceargo-rolloutskubectlapply-nargo-rollouts-fhttps://github.com/argoproj/argo-ro......
  • SpringBoot 自定义注解,轻松实现 Redis 分布式锁
    1.自定义注解类@Documented@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.METHOD)public@interfaceReqFastLimit{//rediskeyStringkey()d......
  • Docker-swarm容器编排
    Docker-swarm容器编排1.先安装dockercurl-o/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repocurl-o/etc/yum.repos.d/docker-ce.......