在本教程中,我们将学习如何在CentOS 7 / RHEL 7上安装Redis服务器。 redis的缩写是REmote DIctionary Server。
它是最流行的开源,高级键值缓存和存储之一。
reids的官方网站地址: http://redis.io/
如果你的服务器没有安装wget下载程序的话,需要先安装wget,
Install wget command:
yum install wget
Install redis server
Now use yum command to install redis server
yum install redis
Two important redis server configuration file’s path1. /etc/redis.conf
2. /etc/redis-sentinel.conf
Now start the redis server after this.
systemctl start redis.service
Check the running status of redis server
systemctl status redis.service
To test the installation of Redis, use below given command
If the response output is PONG, it means installation is completed successfully.
[root@localhost ~]# redis-cli ping
PONG
[root@localhost ~]#
Start/Stop/Restart/Status and Enable redis server
To start redis server
systemctl start redis.service
To stop redis server
systemctl stop redis.service
To restart redis server
systemctl restart redis.service
To get running status of redis server
systemctl status redis.service
To enable redis server at system’s booting time.
systemctl enable redis.service
To disable redis server at system’s booting time.
systemctl disable redis.service
查看redis是否启动:
reids-server
打开redis终端:
redis-cli
首次在php中使用redis时,我遇到了class 'Redis' not found的错误,
$redis = new Redis();
最后再网上发现需要再Redis前面加上\,
$redis = new \Redis();