前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Redis 容器与配置(2)

Redis 容器与配置(2)

作者头像
franket
发布2021-10-20 09:55:26
3520
发布2021-10-20 09:55:26
举报
文章被收录于专栏:技术杂记

启动一个redis容器

由于本地并没有 redis 镜像,所以它会自动去 dockerhub 上拉取

代码语言:javascript
复制
[root@h104 ~]# docker run --name test-redis -d redis
Unable to find image 'redis:latest' locally
latest: Pulling from library/redis
70e9a6907f10: Pull complete 
32f2a4cccab8: Pull complete 
34446d9c0a72: Pull complete 
145623ef4dd4: Pull complete 
8d9771e0b6ee: Pull complete 
018a9e995b7a: Pull complete 
0deb375d521a: Pull complete 
c152ff671a13: Pull complete 
aa64b511d09c: Pull complete 
23c6ea3916be: Pull complete 
9cd603438a28: Pull complete 
8be59f114d61: Pull complete 
70aeeb507933: Pull complete 
840927008ad0: Pull complete 
970117e3ce7f: Pull complete 
9d6240c55f04: Pull complete 
b2f46bd01929: Pull complete 
1f4ff6e27d64: Pull complete 
Digest: sha256:68524efa50a33d595d7484de3939a476b38667c7b4789f193761899ca125d016
Status: Downloaded newer image for redis:latest
71c69b5bf62cc4521a43f91869114d598eab5d4826372371909c461e6f024f71
[root@h104 ~]#
[root@h104 ~]# docker ps 
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
71c69b5bf62c        redis               "docker-entrypoint.sh"   49 seconds ago      Up 48 seconds       6379/tcp            test-reds
[root@h104 ~]#
[root@h104 ~]# docker logs 71c69b5bf62c
1:C 28 Apr 02:41:05.459 # Warning: no config file specified, using the default config. In order to specify a config file use redis-sever /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

1:M 28 Apr 02:41:05.461 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to te lower value of 128.
1:M 28 Apr 02:41:05.461 # Server started, Redis version 3.0.7
1:M 28 Apr 02:41:05.461 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this isse add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to tke effect.
1:M 28 Apr 02:41:05.461 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and emory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, nd add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 28 Apr 02:41:05.461 * The server is now ready to accept connections on port 6379
[root@h104 ~]# sysctl -a | grep  vm.overcommit_memory
vm.overcommit_memory = 0
[root@h104 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
[root@h104 ~]#
[root@h104 ~]# docker images  | grep redis
redis                                   latest              1f4ff6e27d64        6 days ago          177.4 MB
[root@h104 ~]# 

从日志中可以看到,redis通过检查系统配置给出了一些优化建议,以便更好的发挥其性能

这种状态下的redis在后台运行,没有公开端口可以让外面的客户端直连

但是可以通过link的方式,实现容器间的对接

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 启动一个redis容器
相关产品与服务
云数据库 Redis
腾讯云数据库 Redis(TencentDB for Redis)是腾讯云打造的兼容 Redis 协议的缓存和存储服务。丰富的数据结构能帮助您完成不同类型的业务场景开发。支持主从热备,提供自动容灾切换、数据备份、故障迁移、实例监控、在线扩容、数据回档等全套的数据库服务。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档