简易redis压测教程-linux ubuntu下

安装mysql

环境信息:

OS:Ubuntu18.04
MySQL: 5.7.22

一、安装mysql
#命令1
sudo apt-get update
#命令2
sudo apt install redis-server
二、配置mysql
sudo vi /etc/redis/redis.conf

在文件中,找到supervised指令。 该指令允许您声明一个init系统来管理Redis作为服务,从而为您提供对其操作的更多控制。 受supervised指令默认设置为no 。 由于您正在运行使用systemd init系统的Ubuntu,请将其更改为systemd :

# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
#   supervised no      - no supervision interaction
#   supervised upstart - signal upstart by putting Redis into SIGSTOP mode
#   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
#   supervised auto    - detect upstart or systemd method based on
#                        UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
#       They do not enable continuous liveness pings back to your supervisor.
supervised systemd

重新加载Redis服务文件以反映您对配置文件所做的更改:

sudo service redis restart
三、检查安装结果
sudo systemctl status redis
四、设置密码
sudo vi /etc/redis/redis.conf

找到下面这一行

\# requirepass foobared 

将注释符号去掉,将后面修改成自己的密码,如:

requirepass 123456

重启服务

sudo service redis restart


通过redis-benchmark压测

命令示例

一、并发数100,循环10次,主动建表和生成数据,指定表引擎为innodb,总的查询次数为100:

redis-benchmark -q -n 100000
相关操作可以参考其他redis-benchmark使用教程文章

脚本看这里

python编写mysql和redis压测脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值