C++问题--Reis连接redisContext *pRedisContext = redisConnectWithTimeout("127.0.0.1", 6379, tv);pRedisContext->errstr返回错误磁盘空间不足
一、问题
使用C++连接Redis的时候出错,错误String为磁盘空间不足,连接代码如下:
//reids默认监听端口6387
int iTimeout = ;
struct timeval tv;
tv.tv_sec = iTimeout / ;
tv.tv_usec = iTimeout * ; redisContext *pRedisContext = redisConnectWithTimeout("127.0.0.1", , tv);
if (NULL == pRedisContext || pRedisContext->err)
{
printf("%s \r\n", pRedisContext->errstr);
printf("Connect to redis server failed \n");
return -;
}
返回错误值打印:

二、原因
出现这个问题的原因是:
1. redis的设置的占用内存太大,例如, 电脑的内存是物理内存是8GB,最大的文件设置内存是 (8)+(2*8) GB为24GB.
2.也可能是 maxheap 标识有问题, 这个是因为位置文件中少了maxheap的配置
这个问题已经在Redis.windows.conf里面说明:
# WARNING: not setting maxmemory will cause Redis to terminate with an
# out-of-memory exception if the heap limit is reached.
#
三、解决办法步骤
1. 去除 redis.windows.conf 中# maxmemory <bytes>前的#号,并写上bytes为10240000,如下:
# WARNING: not setting maxmemory will cause Redis to terminate with an
# out-of-memory exception if the heap limit is reached.
#
# NOTE: since Redis uses the system paging file to allocate the heap memory,
# the Working Set memory usage showed by the Windows Task Manager or by other
# tools such as ProcessExplorer will not always be accurate. For example, right
# after a background save of the RDB or the AOF files, the working set value
# may drop significantly. In order to check the correct amount of memory used
# by the redis-server to store the data, use the INFO client command. The INFO
# command shows only the memory used to store the redis data, not the extra
# memory used by the Windows process for its own requirements. Th3 extra amount
# of memory not reported by the INFO command can be calculated subtracting the
# Peak Working Set reported by the Windows Task Manager and the used_memory_peak
# reported by the INFO command.
#
maxmemory 2gb
2. 修改连接方式为redisConnect,若需要使用超时设定,请在redis.windows.conf中进行设置:

C++问题--Reis连接redisContext *pRedisContext = redisConnectWithTimeout("127.0.0.1", 6379, tv);pRedisContext->errstr返回错误磁盘空间不足的更多相关文章
- MongoDB 由于目标计算机积极拒绝,无法连接 2014-07-25T11:00:48.634+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:10061
转载自:http://www.cnblogs.com/xiaoit/p/3867573.html 1:启动MongoDB 2014-07-25T11:00:48.634+0800 warning: F ...
- 127.0.0.1\SQLEXPRESS连接异常
当你的数据库为SQLEXPRESS时,在程序的数据库连接字符串的服务Server使用127.0.0.1\SQLEXPRESS时,如下: 它会显示一异常: Server Error in '/' App ...
- linux下使用localhost和127.0.0.1都不能连接的解决思路
linux下刚安装了mysql,尝试写了程序连接mysql,出现了只有用本地ip地址才能连接,而127.0.0.1和localhost都不能访问 解决这个问题主要查看3个方向 .hosts中是否有ip ...
- 【MongoDB】2014-07-25T11:00:48.634+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:10061 由于目标计算机积极拒绝,无法连接。
1:启动MongoDB 2014-07-25T11:00:48.634+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errn ...
- CentOS下php使用127.0.0.1不能连接mysql的解决方法
这篇文章主要介绍了CentOS下php使用127.0.0.1不能连接mysql的解决方法,本文原因是SELINUX导致的连接失败,需要的朋友可以参考下 php代码很简单: 复制代码代码如下: $ser ...
- Serv-U无法连接到服务器127.0.0.1,端口43958 FTP服务器不能启动
端口43958,这是Serv-U的本地管理端口,只允许127.0.0.1连接. 在出现“Serv-U无法连接到服务器127.0.0.1,端口43958”这个错误的时候,一般ftp软件无法自动启动 ...
- Linux无法连接上127.0.0.1,拒绝连接,更新时提示无法下载,无法正常使用apt-get update
你是否遇到过这种情况,在Linux以apt-get update 时更新的时候无法更新,提示一下内容 p { margin-bottom: 0.25cm; line-height: 120% } 错误 ...
- Linux无法正常连接服务器,无法连接上 127.0.0.1:8989 (127.0.0.1)。 - connect (111: 拒绝连接)
最近修改了下电脑的hosts文件,电脑就突然不能连接下载更新的服务器了,但是浏览器还能正常上网,这让我很是难受啊!!! 错误现象如下: 错误:1 http://archive.ubuntukylin. ...
- windows redis 连接错误Creating Server TCP listening socket 127.0.0.1:637 9: bind: No error
报错信息如下: [10036] 30 Dec 10:23:49.616 # Creating Server TCP listening socket 127.0.0.1:637 9: bind: No ...
随机推荐
- Java代码生成器Easy Code
EasyCode是基于IntelliJ IDEA开发的代码生成插件,支持自定义任意模板(Java,html,js,xml).只要是与数据库相关的代码都可以通过自定义模板来生成.支持数据库类型与java ...
- python_二叉树简单实现
今日头条面试题,先做下: 二叉树代码实现 class Node: def __init__(self,item): self.item = item self.child1 = None self.c ...
- [国家集训队] JZPKIL
题目链接 洛谷:https://www.luogu.org/problemnew/show/P4464 Solution 这题是真的毒....数论大杂烩,窝断断续续写了两天. 众所周知: \[ {\r ...
- M-SOLUTIONS Programming Contest
A.(n-2)*180 #include<cstdio> #include<cstring> #include<iostream> #include<algo ...
- 记录用到的mssql的几个方法
1.RIGHT ( character_expression , integer_expression ) 返回字符串中从右边开始指定个数的字符 character_expression 字符或二进制 ...
- DDL 操作表结构
DDL 操作表结构:CRUD 一.C(create)创建 1.创建表 create table 表名( 列名1 数据类型1, 列名2 数据类型2, 列名3 数据类型3, ... 列名n 数据类型n ) ...
- django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17)
https://blog.csdn.net/qq_39969226/article/details/92218635
- [JAVASCRIPT][EXTJS]直接用JSON创建树形控件(Ext.tree.TreePanel )(转)
直接用JSON创建树形控件(Ext.tree.TreePanel ) 1.创建多个根节点的树形 2.直接使用JsonList创建树形 <!DOCTYPE HTML PUBLIC "-/ ...
- Mysql中decode函数的几种用法
1.使用decode判断字符串是否一样 decode(value,if1,then1,if2,then2,if3,then3,...,else) 含义为 IF 条件=值1 THEN RETURN(va ...
- pycharm社区版对于django项目的创建
学习django的基础的东西:python基础(虽然自己看了一遍,不过还有好多东西都是一知半解的,所以还要重复看,去加强自己的基础). 数据库SQL(自己也是对一些基础语句运用的不熟练,然后接下来的主 ...