centos 安装单机版 redis4.0.10
redis源码地址: http://download.redis.io/releases/
下载 redis-4.0.10.tar.gz 和 redis-stable.tar.gz
第一步:安装gcc编译环境
yum install gcc-c++
第二步:把redis的源码上传到linux服务器。
第三步:解压缩。
tar -zxvf redis-4.0.10.tar.gz
第四步:进入解压后的文件夹, make
第五步:make install PREFIX=/usr/local/redis
第六步: (忽略,因为已经下载过了 )wget http://download.redis.io/redis-stable.tar.gz(下载redis-cli的压缩包)
第七步:tar xvzf redis-stable.tar.gz(解压)
第八步:cd redis-stable(进入redis-stable目录)
make(安装)
sudo cp src/redis-cli /usr/local/bin/(将redis-cli拷贝到bin下,让redis-cli指令可以在任意目录下直接使用)
按照上面的指令执行之后redis-cli就可以正常执行了,注意上面的几条指令必须都执行,make是单独的一条。
启动redis
两种启动方式,前端启动、后台启动。
前端启动:
cd /usr/local/redis
./redis-server
后台启动:
1、复制redis.conf到redis的安装目录
2、修改redis.conf。修改daemonize yes
3、[root@bogon redis]# ./redis-server redis.conf
redis关闭
到redis节点目录下执行如下命令
redis-cli -p 端口号 shutdown
redis启动
./redis-server 参数
参数:redis.conf文件全路径
客户端
redis-cli -p 端口 -h ip地址 <-c>连接集群时使用此参数
默认端口:6379
Ip:localhost(127.0.0.1)
RedisDesktopManager:
只能在单机版环境使用。不支持redis集群。
其他记录:
没想到在进行连接时报了下面这么一个错,fuck,Linux上的redis还真是麻烦,哪像windows上的redis这么简单一解压完事
Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions:
1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent.
2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server
3) If you started the server manually just for testing, restart it with the '--protected-mode no' option.
4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
at redis.clients.jedis.Protocol.processError(Protocol.java:127)
at redis.clients.jedis.Protocol.process(Protocol.java:161)
at redis.clients.jedis.Protocol.read(Protocol.java:215)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239)
at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:196)
at com.example.redis.JedisTest.main(JedisTest.java:24)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
经过我英语八级的翻译,上面一共提供了四种解决方案,但是综合考虑为了简单起见只需要执行以下几步即可:
1.修改redis.conf配置文件,将绑定的ip地址端口号给注释见下图
2.由于Linux上的redis处于安全保护模式,这就让你无法从虚拟机外部去轻松建立连接,这里就有两种解决方法,一种是在redis.conf中设置保护模式为no,见下图
3.另外一种方式是加上安全认证,即redis默认是没有密码的可以直接登录,这里加上密码,配置见下图
4.好吧,此时你以为轻松解决问题了,于是再次在Linux启动redis服务器后,在外部连接还是报错,真是too young too native,起初我以为是配置没有生效,因为明明配置都写好了,于是杀掉redis的相关进程重启服务,结果发现还是没卵用。最后研究发现问题所在:之前启动redis-server并没有指定配置文件,而Linux上的redis比较操蛋的一点就是如果你不指定配置文件去启动,那么你做的修改就没有用,会读取默认配置(PS:至于这个默认配置在哪我也不清楚),于是用下面这种方式启动就可以使修改的配置文件生效,至于config rewrite命令我测试了并没有什么卵用。
5.再次测试,在windows上进行jedis连接测试,出现下面pong(),恼人的错误终于消失了,比起windows版本的redis还真是让人龟毛啊,如果配置了密码认证,调用Jedis的auth方法输入密码即可
修改redis.conf文件,将daemonize改为yes
无奈在最后关闭redis的服务的时候,redis服务报错redis (error) ERR Errors trying to SHUTDOWN. Check logs.,怎么关都关不掉,百度一番,信息很少,无奈多次尝试,终于解决。方法如下:
打开redis安装目录下的redis.conf找到
# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./
这一段
把die ./改为相应的目录,如"dir /home/distance/redis_dbfiles/"(这里需要注意最后的斜杠不能忘记,如果缺失斜杠可能会解析为文件而非目录),保存。
centos 安装单机版 redis4.0.10的更多相关文章
- 【安装】Redis4.0.10在Linux环境搭建
1.下载Redis后上传到指定目录 2.解压 tar -zxvf redis-4.0.10.tar.gz 3.进入加压后的目录并编译 cd redis-4.0.10 make 4.进入src目录安装 ...
- CentOS 7安装Redis4.0.10
cd /usr/local/src && wget http://download.redis.io/releases/redis-4.0.10.tar.gz && t ...
- Redis(二)CentOS7安装Redis4.0.10与集群搭建
一 Redis单机安装 1 Redis下载安装 1.1 检查依赖环境(Redis是C语言开发,编译依赖gcc环境) [root@node21 redis-]$ gcc -v -bash: gcc: c ...
- redis4.0.10安装与常用命令
----------- redis安装 ------------------------------------------- 安装reids:https://redis.io/download (4 ...
- Linux下安装redis-4.0.10
1.下载redis-4.0.10 在redis官网(https://redis.io/download)下载redis-4.0.10 2.将安装包上传至Linux服务器 在Linux服务器根目录下创建 ...
- ubuntu 14.04 安装 Apache Thrift 0.10
1.到官网下载源码压缩文件 https://thrift.apache.org/download 2.安装依赖软件,可以参考 https://thrift.apache.org/docs/instal ...
- 安装新版redis4.0.6
看看新版本有那些特性提升,测试用!先安装 网址:https://redis.io/download 获取:wget http://download.redis.io/releases/redis-4. ...
- centos php7.1 redis4.0.9 安装扩展phpredis
1.扩展列表 https://github.com/phpredis/phpredis/releases [root@VM_27_0_centos server]# ls data lib.pl my ...
- centos 安装 redis3.2.0 集群
这里创建6个redis节点,其中三个为主节点,三个为从节点. redis和端口对应关系: 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 从: 127.0.0 ...
随机推荐
- greasemonkey修改网页url
// ==UserScript== // @name JSHE_ModifyFunction // @namespace jshe // @include http://localhost/* // ...
- 【转】每天一个linux命令(45):free 命令
原文网址:http://www.cnblogs.com/peida/archive/2012/12/25/2831814.html free命令可以显示Linux系统中空闲的.已用的物理内存及swap ...
- Eclipse相对路径
Eclipse将java源文件存于src文件夹,而编译生成的class文件存于bin目录下,故以下代码输出的结果为false public class FileTest { public static ...
- MySQL架构设计谈:从开发规范、选型、拆分到减压(转)
作者介绍 李辉,原新浪爱彩票运维负责人,常用网名:门牙没了.曾主导新浪爱彩票的MySQL运维工作.培训合伙人.资深讲师,中国科学院大学在读研究生(大数据方向),擅长大型项目的关系型数据库运维和管理,现 ...
- Exchange 2003服务器中如何在公司资料夹中设置共享行事历
Exchange 2003服务器中如何在公司资料夹中设置共享行事历 编写人:左丘文 2018-2-23 春节假期归来,开工第一天,感觉还没有从假期中恢复及调整过来.突然想到了我已经荒废了近一年的园子, ...
- c#中如何获取本机MAC地址、IP地址、硬盘ID、CPU序列号等系统信息
我们在利用C#开发桌面程序(Winform)程序的时候,经常需要获取一些跟系统相关的信息,例如用户名.MAC地址.IP地址.硬盘ID.CPU序列号.系统名称.物理内存等. 首先需要引入命名空间: us ...
- sql server 2008数据库 降为 sql server 2005数据库 最终方案总结
由于xx原因,sql server 要降级,所以有了下文.... 一 直接 通过sql server 自带工具 生成脚本即可,具体操作方法如下: 1.打开 Microsoft Sql Server M ...
- 论战大数据----胖子哥的PK之旅(一)
胖子哥(1106110976) 9:35:36 http://www.cnblogs.com/hadoopdev/p/3531963.htmlnosqlt数据库-肖(380594863) 9:38:0 ...
- bzoj1830 Y形项链
Description 小可可得到了一个可爱的Y型项链.小可可现在的项链是这个样子的:项链的最中间有一颗大珍珠作为结合点,从大珍珠上连出来3条由各种宝石串起来的链子.小可可希望让这3个链子完全一样,她 ...
- 6-3-2绕过appium的iOS测试
WDA自带的inspector 1.启动WDA Xcode启动:product-test,适合个人调试 命令行启动:适合持续集成 UDID=$(idevice_id -l) xcodebuild -p ...