惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
爱范儿
爱范儿
量子位
博客园 - 聂微东
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
GbyAI
GbyAI
MyScale Blog
MyScale Blog
IT之家
IT之家
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
The Register - Security
The Register - Security
Microsoft Security Blog
Microsoft Security Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
雷峰网
雷峰网
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - 叶小钗
D
DataBreaches.Net
B
Blog
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
腾讯CDC
T
Threat Research - Cisco Blogs
SecWiki News
SecWiki News
Martin Fowler
Martin Fowler
D
Docker
Cisco Talos Blog
Cisco Talos Blog
T
Tenable Blog
Webroot Blog
Webroot Blog
宝玉的分享
宝玉的分享

博客园 - Chen.HJ

python用正则对字符串进行运算 Nginx安装和遇到过的坑 Nginx、Tomcat和Redis配置文件说明 python + selenium 获取标签文本的为空解决办法 Python读取Excel Python使用paramiko的SFTP get或put整个目录 Linux系统性能监控工具nmon python+selenium个人学习笔记11-登录封装与调用 python+selenium+unittest测试框架4-邮件发送最新测试报告 python+selenium+unittest测试框架3-项目构建和发送邮件 python+selenium+unittest测试框架2-装饰器@classmethod python+selenium+unittest测试框架1-unittest单元测试框架和断言 python+selenium个人学习笔记10-调用JavaScript和截图 python+selenium个人学习笔记9-文件上传和cookie操作 python+selenium个人学习笔记8-获取信息和勾选框 python+selenium个人学习笔记7-警告框处理和下拉框选择 python+selenium个人学习笔记6-元素等待 python+selenium个人学习笔记5-多窗口和多表单切换 python+selenium个人学习笔记4-鼠标和键盘操作
Redis安装与常用命令
Chen.HJ · 2019-07-25 · via 博客园 - Chen.HJ

一、安装

1.上传 redis-4.0.2.tar.gz到Redis服务器的/usr/local/src目录下

2.解压Redis基础安装包,然后进入解压后的目录,指以定安装位置的方式安装Redis,命令如下:
  # cd /usr/local/src
  # tar -zxvf redis-4.0.2.tar.gz
  # cd redis-4.0.2
  # make
  # make install PREFIX=/usr/local/redis

3.创建/usr/local/redis/conf目录和/usr/local/redis/log
  # mkdir /usr/local/redis/conf
  # mkdir /usr/local/redis/log

4.上传redis.conf文件到/usr/local/redis/conf目录,主要修改配置文件中的几项内容如下:
  bind 0.0.0.0 #绑定ip,只有通过此ip才能访问redis服务,修改为本机ip
  port 6379 #修改为规划端口
  pidfile /usr/local/redis/conf/redis_6379.pid #进程id文件地址,6379改为规划端口
  logfile "/usr/local/redis/log/redis_6379.log" #日志文件地址,6379改为规划端口
  dbfilename dump_6379.rdb #rdb文件名称,6379改为规划端口
  dir /usr/local/redis/conf #redis默认路径,修改为配置文件所在路径
  requirepass foobared #连接redis密码,如需启用密码,先取消注释,再修改为规划的redis服务密码
  appendfilename "appendonly_6379.aof" #aof文件名称,6379改为规划端口

5.集群环境还需修改以下配置
  cluster-enabled yes #修改为yes开启集群模式
  cluster-config-file nodes_6379.conf #集群节点配置文件名称,6379修改为规划端口
  cluster-node-timeout 15000 #集群检测超时时间,修改为15000,即15秒

二、常用命令

1、进入redis:redis-cli -h IP地址 -p 端口 ,如:redis-cli -h 127.0.0.1 -p 6381
结果展示:127.0.0.1:6381>

2、查看slowlog总条数:SLOWLOG LEN ,如:127.0.0.1:6381> slowlog len
结果展示:
(integer) 4

3、查看slowlog:SLOWLOG GET ,如:127.0.0.1:6381> slowlog get
结果展示:
1) 1) (integer) 26 // slowlog唯一编号id
2) (integer) 1440057815 // 命令执行时的时间戳,代表本条命令的执行时间
3) (integer) 47 // 命令执行耗时(微妙),代表本条命令查询耗时47微秒
4) 1) "SLOWLOG" // 执行的命令,完整命令为 SLOWLOG GET,slowlog最多保存前面的31个key和128字符
2) "GET"

4、查看集群节点的情况:cluster nodes ,如:cluster nodes

5、停用redis节点:redis-cli -p Redis端口号 shutdown

6、启用redis节点:redis-server 节点配置文件路径

7、启用redis集群:src/redis-trib.rb create --replicas 1 172.16.4.132:6380 172.16.4.132:6381 172.16.4.133:6380 172.16.4.133:6381 172.16.4.134:6380 172.16.4.134:6381 172.16.4.135:6380 172.16.4.135:6381

JAVA_OPTS="-Xms32m -Xmx128m -Xss32K -XX:PermSize=16m -XX:MaxPermSize=64m"

附:tcpdump -s0 -i eth0 -w /opt/testDump.cap 抓eth0网卡的所有包命令