安装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