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 ...
随机推荐
- 零基础逆向工程21_PE结构05_数据目录表_导出表
数据目录 1.我们所了解的PE分为头和节,在每个节中,都包含了我们写的一些代码和数据,但还有一些非常重要 的信息是编译器替我们加到PE文件中的,这些信息可能存在在任何可以利用的地方. 2.这些信息之所 ...
- Windows Azure 配置Active Directory 主机(1)
现在越来越多企业将自己业务系统迁移云端,方便公司日常运维管理.这篇文章将简单介绍一下,从 Windows Azure 虚拟网络上的虚拟机 (VM) 中的 Corp Active Directory 林 ...
- Python3+Selenium3+webdriver学习笔记12(js操作应用:滚动条 日历 内嵌div)
#!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记12(js操作应用:滚动条 日历 内嵌div)'''from ...
- python+selenium之断言Assertion
一.断言方法 断言是对自动化测试异常情况的判断. # -*- coding: utf-8 -*- from selenium import webdriver import unittest impo ...
- UVA 714 Copying Books 抄书 (二分)
题意:把一个包含m个正整数的序列划分成k个非空的连续子序列.使得所有连续子序列的序列和Si的最大值尽量小. 二分,每次判断一下当前的值是否满足条件,然后修改区间.注意初始区间的范围,L应该为所有正整数 ...
- 如何使用Python生成200个优惠券(激活码)
解析: 常见的优惠券(激活码)是由数字.字母(大小写)组成: string.ascii_letters 26个大小写字母: string.digits 0-9数字: 随机组合 使用random.s ...
- SpringMVC归纳
SpringMVC归纳 操作流程 配置前端控制器 在web.xml中配置 配置处理器映射器 在springmvc配置文件中配置 配置处理器适配器 在springmvc配置文件中配置 配置注解适配器和映 ...
- 7.Props向子组件传递数据
组件实例的作用域是孤立的.这意味着不能并且不应该在子组件的模板内直接引用父组件的数据. 可以使用 props 把数据传给子组件. for-child-msg="aaa" , fo ...
- javaweb基础(10)_HttpServletRequest原理介绍
一.HttpServletRequest介绍 HttpServletRequest对象代表客户端的请求,当客户端通过HTTP协议访问服务器时,HTTP请求头中的所有信息都封装在这个对象中,通过这个对象 ...
- Oracle数据库常用的Sql语句整理
Oracle数据库常用的Sql语句整理 查看当前用户的缺省表空间 : select username,default_tablespace from user_users; 2.查看用户下所有的表 : ...