How to install redis server on CentOS 7 / RHEL 7
在本教程中,我们将学习如何在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();
访问远程Redis服务。Connect to Remote Redis Server
使用客户端远程连接redis
通常来说,生产环境下的Redis服务器只设置为仅本机访问(Redis默认也只允许本机访问)。有时候我们也许需要使Redi能被远程访问。
配置
修改Redis配置文件/etc/redis/redis.conf,找到bind那行配置:
# bind 127.0.0.1
去掉#注释并改为:
bind 0.0.0.0
指定配置文件然后重启Redis服务即可:
sudo redis-server /etc/redis/redis.conf
关于bind配置的含义,配置文件里的注释是这样说的:
# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1
远程连接
配置好Redis服务并重启服务后。就可以使用客户端远程连接Redis服务了。命令格式如下:
$ redis-cli -h {redis_host} -p {redis_port}
其中{redis_host}就是远程的Redis服务所在服务器地址,{redis_port}就是Redis服务端口(Redis默认端口是6379)。例如:
$ redis-cli -h 120.120.10.10 -p
redis>ping
PONG
How to install redis server on CentOS 7 / RHEL 7的更多相关文章
- Install RabbitMQ server in CentOS 7
About RabbitMQ RabbitMQ is an open source message broker software, also sometimes known as message-o ...
- Official online document, install svn server in centOS
http://www.krizna.com/centos/install-svn-server-on-centos-6/
- Install Jetty web server on CentOS 7 / RHEL 7
http://www.eclipse.org/jetty/download.html http://www.eclipse.org/jetty/documentation/current/startu ...
- Install Tomcat 6 on CentOS or RHEL --转载
source:http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos This post will cover installa ...
- Install EPEL repo on CentOS 7 / RHEL 7
On CentOS 7, we have found without downloading the epel-release RPM package(as we used to do on prev ...
- 虚拟机centOS中安装Redis,主机Redis Destop Manager不能访问虚拟机Redis server的解决方案
今天在学些redis的时候碰到个问题,发现主机Redis Destop Manager不能访问虚拟机Redis server的解决方案,找了一些网上的资料,原因可能有两个,整理记录下来: 1. Red ...
- How to install Redis 3.2 on CentOS 6 and 7
What is Redis? Redis is a flexible open-source, key value data store, used as a database, cache and ...
- Install Redis on CentOS 6.4--转
Install Redis on CentOS 6.4 source:http://thoughts.z-dev.org/2013/05/27/install-redis-on-centos-6-4/ ...
- Install TightVNC Server in RHEL/CentOS and Fedora to Access Remote Desktops
Virtual Networking Computing (VNC) is a Kind of remote sharing system that makes it possible to take ...
随机推荐
- IE盒子模型和W3C盒子模型
IE盒模型出现在ie5.5以下的版本当中,ie6以上就实行W3C盒模型. box-sizing有两个属性,border-box和content-box. border-box对应传统的盒子模型,即ie ...
- VMware虚拟机中red hat linux ping不通宿主物理主机原因
在VMware Workstation中安装了red hat enterprise linux系统,网络使用“桥接”形式,最后出现在Windows下能够Ping通虚拟主机,而虚拟主机Ping不通Win ...
- python读xml文件
# -*- coding:utf-8 -*- import jsonimport requestsimport os curpath=os.path.dirname(os.path.realpath( ...
- .NET 读取视频文件
该篇文章 复制别人的文章 在.NET中处理视频是一件痛苦的事情,.NET并没有提供视频处理的类.于是咱们只能找一些第三方的类库或者自己实现,在项目时间比较赶的情况下,自己实现是不可能的了,而且说不定会 ...
- nginx只允许域名访问网址,禁止ip访问
修改nginx配置 文件 在server段里插入如下正则: if ( $host != 'www.baidu.com') { return 403; } 说明:如果访问讨还不是www.baidu.co ...
- LibreOJ #514. 「LibreOJ β Round #2」模拟只会猜题意
内存限制:256 MiB 时间限制:1000 ms 标准输入输出 题目类型:传统 评测方式:文本比较 题目描述 给定一个长度为 nnn 的序列 AAA . 定义 f(l,r)=∑i=lrAif(l,r ...
- AJAX不能访问MVC后台程序的问题
AJAX不能访问后台的MVC有可能是MVC的后台程序加入了身份验证[Authorize]标记,这样前台的AJAX虽然结果显示的是4和200但是responsetext的值可以看到是返回了一个配置文件中 ...
- java 自定义容器,实现foreach
import java.util.Arrays; import java.util.Iterator; public class ArrayList implements Iterable<In ...
- <!DOCTYPE>声明
定义和用法 <!DOCTYPE> 声明必须是 HTML 文档的第一行,位于 <html> 标签之前. <!DOCTYPE> 声明不是 HTML 标签:它是指示 we ...
- 直接用bcdedit创建bootmgr数据库和修复启动菜单
直接用bcdedit创建bootmgr数据库和修复启动菜单 使用下面方法之前需要bcdedit和bootsect两条命令,这两条命令可以到vista或者windows 7安装光盘上获得.bootsec ...