查看Redis集群所有节点内存工具
指定集群中任意一个节点,查看集群中所有节点当前已用物理内存、配置的最大物理内存和系统物理内存。
源码(可从https://github.com/eyjian/redis-tools下载):
#!/bin/bash
# Query the memory of all nodes in a cluster
#
# Output example:
# $ ./query_redis_cluster.sh 192.168.0.31.21:6379
# [192.168.0.31.21:6379] Used: 788.57M Max: 15.00G System: 125.56G
# [192.168.0.31.22:6380] Used: 756.98M Max: 15.00G System: 125.56G
# [192.168.0.31.23:6380] Used: 743.93M Max: 15.00G System: 125.56G
# [192.168.0.31.24:6380] Used: 21.73M Max: 15.00G System: 125.56G
# [192.168.0.31.25:6380] Used: 819.11M Max: 15.00G System: 125.56G
# [192.168.0.31.24:6379] Used: 771.70M Max: 15.00G System: 125.56G
# [192.168.0.31.26:6379] Used: 920.77M Max: 15.00G System: 125.56G
# [192.168.0.31.27:6380] Used: 889.09M Max: 15.00G System: 125.27G
# [192.168.0.31.28:6379] Used: 741.24M Max: 15.00G System: 125.56G
# [192.168.0.31.29:6380] Used: 699.55M Max: 15.00G System: 125.56G
# [192.168.0.31.27:6379] Used: 752.89M Max: 15.00G System: 125.27G
# [192.168.0.31.21:6380] Used: 716.05M Max: 15.00G System: 125.56G
# [192.168.0.31.23:6379] Used: 784.82M Max: 15.00G System: 125.56G
# [192.168.0.31.26:6380] Used: 726.40M Max: 15.00G System: 125.56G
# [192.168.0.31.25:6379] Used: 726.09M Max: 15.00G System: 125.56G
# [192.168.0.31.29:6379] Used: 844.59M Max: 15.00G System: 125.56G
# [192.168.0.31.28:6380] Used: 14.00M Max: 15.00G System: 125.56G
# [192.168.0.31.22:6379] Used: 770.13M Max: 15.00G System: 125.56G
REDIS_CLI=${REDIS_CLI:-redis-cli}
REDIS_IP=${REDIS_IP:-127.0.0.1}
REDIS_PORT=${REDIS_PORT:-6379}
function usage()
{
echo "Usage: `basename $0` redis_node"
echo "Example: `basename $0` 127.0.0.1:6379"
}
# with a parameter: single redis node
if test $# -ne 1; then
usage
exit 1
fi
eval $(echo "$1" | awk -F[\:] '{ printf("REDIS_IP=%s\nREDIS_PORT=%s\n",$1,$2) }')
if test -z "$REDIS_IP" -o -z "$REDIS_PORT"; then
echo "Parameter error"
usage
exit 1
fi
# 确保redis-cli可用
which "$REDIS_CLI" > /dev/null 2>&1
if test $? -ne 0; then
echo "\`redis-cli\` not exists or not executable"
exit 1
fi
redis_nodes=`redis-cli -h $REDIS_IP -p $REDIS_PORT cluster nodes | awk -F[\ \:\@] '!/ERR/{ printf("%s:%s\n",$2,$3); }'`
if test -z "$redis_nodes"; then
# standlone
$REDIS_CLI -h $REDIS_IP -p $REDIS_PORT FLUSHALL
else
# cluster
for redis_node in $redis_nodes;
do
if test ! -z "$redis_node"; then
eval $(echo "$redis_node" | awk -F[\:] '{ printf("redis_node_ip=%s\nredis_node_port=%s\n",$1,$2) }')
if test ! -z "$redis_node_ip" -a ! -z "$redis_node_port"; then
items=(`$REDIS_CLI -h $redis_node_ip -p $redis_node_port INFO MEMORY 2>&1 | tr '\r' ' '`)
used_memory_rss_human=0
maxmemory_human=0
total_system_memory_human=0
for item in "${items[@]}"
do
eval $(echo "$item" | awk -F[\:] '{ printf("name=%s\nvalue=%s\n",$1,$2) }')
if test "$name" = "used_memory_rss_human"; then
used_memory_rss_human=$value
elif test "$name" = "maxmemory_human"; then
maxmemory_human=$value
elif test "$name" = "total_system_memory_human"; then
total_system_memory_human=$value
fi
done
echo -e "[\033[1;33m${redis_node_ip}:${redis_node_port}\033[m]\tUsed: \033[0;32;32m$used_memory_rss_human\033[m\tMax: \033[0;32;32m$maxmemory_human\033[m\tSystem: \033[0;32;32m$total_system_memory_human\033[m"
fi
fi
done
fi
查看Redis集群所有节点内存工具的更多相关文章
- (转)高性能网站架构之缓存篇—Redis集群增删节点
标签: 高性能架构集群缓存redis 上一篇文章,我们搭建了Redis-cluster集群,这篇博客跟大家讲一下如何在一个运行的集群上增加节点或者删除节点. Redis集群添加节点 首先我们要新建立一 ...
- Redis集群命令行部署工具
使用之前准备工作: 1)配置好与端口无关的公共redis.conf文件,和工具放在同一目录下 2)配置好与端口相关的模板redis-PORT.conf文件,也和工具放在同一目录下(部署时PORT会被替 ...
- redis 集群新增节点,slots槽分配,删除节点, [ERR] Calling MIGRATE ERR Syntax error, try CLIENT (LIST | KILL | GET...
redis reshard 重新分槽(slots) https://github.com/antirez/redis/issues/5029 redis 官方已确认该bug redis 集群重新(re ...
- 查看Redis集群主从对应关系工具
工具的作用: 1)比"cluster nodes"更为直观的显示结果 2)指出落在同一个IP上的master 3)指出落在同一个IP上的master和slave对 运行效果图: 源 ...
- LINUX:关于Redis集群的节点分配
文章来源:http://www.cnblogs.com/hello-tl/p/7808268.html 根据上述 Redis集群搭建:http://www.cnblogs.com/hello-tl/ ...
- Redis集群增加节点和删除节点
本文主要是承接上一篇文章Redis集群的离线安装成功以后,我们如何进行给集群增加新的主从节点(集群扩容)以及如何从集群中删除节点(集群缩容),也就是集群的伸缩,集群伸缩的原理是控制虚拟槽和数据在节点之 ...
- Redis集群之节点管理
Redis集群一旦启动,就不能轻易删除掉一个节点了. 需要由redis-trib.rg这个ruby脚本行使集群管理的功能.所有的哈希槽都分配于master节点 一.delete master node ...
- redis集群部署+节点端口修改+数据恢复
环境:OS:Centos 7Redis: 3.2.11主 从192.168.1.118:7001 192.168.1.118:8001192.168.1.118:7002 192.168.1.118: ...
- Redis单节点数据同步到Redis集群
一:Redis集群环境准备 1:需要先安装好Redis集群环境并配置好集群 192.168.0.113 7001-7003 192.168.0.162 7004-7006 2:检查redis集群 [r ...
随机推荐
- vue(ajax:axios中文文档)
axios 基于http客户端的promise,面向浏览器和nodejs 特色 浏览器端发起XMLHttpRequests请求 node端发起http请求 支持Promise API 监听请求和返回 ...
- React-router4 第三篇 BasicURL ParametersRedirects (Auth) 谷歌翻译:重定向
依旧是地址 https://reacttraining.com/react-router/web/example/auth-workflow 上来一步走 先导入模块 import React, { P ...
- linux中的设备类型
loop设备 loop设备 一.参考命令[root@localhost a]# losetup usage: losetup loop_device ...
- c++课设学生成绩与学籍管理系统
题目要求(手打,累):设计一个类CStudent,类中包含一个学生的基本数据如下: 编号,姓名,性别,年龄,数学成绩,计算机成绩,外语成绩. 并假设编号为整数,且从1号往后连续编码:姓名为字符串,性别 ...
- Ubuntu下安装VS code
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make sudo apt-get update sudo apt-get install ubun ...
- [Robot Framework] Robot Framework用Execute Javascript对XPath表示的元素执行scrollIntoView操作
有些元素需要通过滚动条滚动才能变得可见. 如果这些元素在DOM结构里面存在,可以通过scrollIntoView让其可见,但如果在DOM结构里面不存在那就要通过拖动滚动条让其变的可见. Execute ...
- netsharp.weixin和sdk的配置信息管理
一.微信公众号后台配置 即在微信公众号后台配置类似如下的url:http://121.40.86.55/wx?oid=gh_befcc6d4c40d 这种情况下会执行WeixinServlet类的do ...
- 前端js数据排序
销量统计系统中国地图热力分布图需要显示一个各省区销量列表,并按从多到少排序.本着轻易不修改后台数据源的原则,决定在前端进行修改实现.其实也容易实现,将数据存放一个数据<省区名称,销量>,然 ...
- jQuery加载完成事件 $(function(){ })的全局异常拦截
通常我们在页面加载完成的时候要写入一些功能脚本,如: $(function(){/*脚本 - 1*/ console.log('start'); }) $(function(){/*脚本 - 2*/ ...
- Windows使用SSH Secure Shell实现免密码登录CentOS
笔记来自:http://blog.csdn.net/jiangshouzhuang/article/details/50683049 1.在Windows上生成密钥找到Secure Shell Cli ...