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

Redis 容器与配置(6)

作者头像
franket
发布2021-10-20 10:00:25
2830
发布2021-10-20 10:00:25
举报
文章被收录于专栏:技术杂记技术杂记

使用容器的方式访问redis容器

代码语言:javascript
复制
[root@h104 x]# docker ps -l 
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
a1a4cfe7e749        redis               "docker-entrypoint.sh"   19 minutes ago      Up 19 minutes       6379/tcp            myredis
[root@h104 x]# docker run -it --link myredis:redis --rm redis redis-cli -h redis -p 6379
redis:6379> CONFIG GET *pidfile*
1) "pidfile"
2) "/data/redis6379.pid"
redis:6379> CONFIG GET timeout 
1) "timeout"
2) "1800"
redis:6379> CONFIG GET *logfile*
1) "logfile"
2) "/data/redis6379.log"
redis:6379> CONFIG GET *dbfilename*
1) "dbfilename"
2) "dump6379.rdb"
redis:6379> CONFIG GET *dir*
1) "dir"
2) "/data"
redis:6379> CONFIG GET *databases*
1) "databases"
2) "50"
redis:6379> info 
# Server
redis_version:3.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:6f8b503a2787e3a6
redis_mode:standalone
os:Linux 3.10.0-327.4.4.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.9.2
process_id:1
run_id:280352487e387d2f70c9358b763dab833094943c
tcp_port:6379
uptime_in_seconds:1281
uptime_in_days:0
hz:10
lru_clock:2238333
config_file:/data/redis6379.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:843568
used_memory_human:823.80K
used_memory_rss:7929856
used_memory_peak:843568
used_memory_peak_human:823.80K
used_memory_lua:36864
mem_fragmentation_ratio:9.40
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1461854844
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:4
total_commands_processed:19
instantaneous_ops_per_sec:0
total_net_input_bytes:757
total_net_output_bytes:1178
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:5.66
used_cpu_user:0.23
used_cpu_sys_children:0.03
used_cpu_user_children:0.00

# Cluster
cluster_enabled:0

# Keyspace
redis:6379> select 49
OK
redis:6379[49]> select 50
(error) ERR invalid DB index
redis:6379> select 49
OK
redis:6379[49]> get a 
(nil)
redis:6379[49]> set a b 
OK
redis:6379[49]> get a 
"b"
redis:6379[49]> save 
OK
redis:6379[49]> set b c 
OK
redis:6379[49]> get b 
"c"
redis:6379[49]> save 
OK
redis:6379[49]> quit
[root@h104 x]# 
[root@h104 x]# ls
dump6379.rdb  redis6379.conf  redis6379.log
[root@h104 x]# tail redis6379.log
1:M 28 Apr 14:47:24.523 # 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.
1:M 28 Apr 14:47:24.524 # 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.
1:M 28 Apr 14:47:24.524 * The server is now ready to accept connections on port 6379
1:M 28 Apr 15:09:11.241 * 1 changes in 900 seconds. Saving...
1:M 28 Apr 15:09:11.275 * Background saving started by pid 14
14:C 28 Apr 15:09:11.460 * DB saved on disk
14:C 28 Apr 15:09:11.461 * RDB: 6 MB of memory used by copy-on-write
1:M 28 Apr 15:09:11.515 * Background saving terminated with success
1:M 28 Apr 15:09:15.457 * DB saved on disk
1:M 28 Apr 15:09:27.514 * DB saved on disk
[root@h104 x]# 
[root@h104 x]# ls
dump6379.rdb  redis6379.conf  redis6379.log
[root@h104 x]# 

本文系转载,前往查看

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

本文系转载前往查看

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 使用容器的方式访问redis容器
相关产品与服务
容器服务
腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档