一、问题

使用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返回错误磁盘空间不足的更多相关文章

  1. 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 ...

  2. 127.0.0.1\SQLEXPRESS连接异常

    当你的数据库为SQLEXPRESS时,在程序的数据库连接字符串的服务Server使用127.0.0.1\SQLEXPRESS时,如下: 它会显示一异常: Server Error in '/' App ...

  3. linux下使用localhost和127.0.0.1都不能连接的解决思路

    linux下刚安装了mysql,尝试写了程序连接mysql,出现了只有用本地ip地址才能连接,而127.0.0.1和localhost都不能访问 解决这个问题主要查看3个方向 .hosts中是否有ip ...

  4. 【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 ...

  5. CentOS下php使用127.0.0.1不能连接mysql的解决方法

    这篇文章主要介绍了CentOS下php使用127.0.0.1不能连接mysql的解决方法,本文原因是SELINUX导致的连接失败,需要的朋友可以参考下 php代码很简单: 复制代码代码如下: $ser ...

  6. Serv-U无法连接到服务器127.0.0.1,端口43958 FTP服务器不能启动

    端口43958,这是Serv-U的本地管理端口,只允许127.0.0.1连接.    在出现“Serv-U无法连接到服务器127.0.0.1,端口43958”这个错误的时候,一般ftp软件无法自动启动 ...

  7. Linux无法连接上127.0.0.1,拒绝连接,更新时提示无法下载,无法正常使用apt-get update

    你是否遇到过这种情况,在Linux以apt-get update 时更新的时候无法更新,提示一下内容 p { margin-bottom: 0.25cm; line-height: 120% } 错误 ...

  8. Linux无法正常连接服务器,无法连接上 127.0.0.1:8989 (127.0.0.1)。 - connect (111: 拒绝连接)

    最近修改了下电脑的hosts文件,电脑就突然不能连接下载更新的服务器了,但是浏览器还能正常上网,这让我很是难受啊!!! 错误现象如下: 错误:1 http://archive.ubuntukylin. ...

  9. 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 ...

随机推荐

  1. 启动mysql服务器

    介绍了启动服务器的两种方式,以及可能遇到的问题 第一种:系统服务 1)可以通过右击方式一步步找到服务 右击计算机->选择管理->找到服务,然后双击打开,找到mysql,我安装的是mysql ...

  2. go 学习笔记(1)go command

    常用命令 go command [arguments] 1) go build  跨平台编译: env GOOS=linux GOARCH=amd64 go build 2) go install : ...

  3. 测试不得不知的python编程小技能-----升级版基础语法和优秀的编码习惯

    编程和学习python,最后快速上手.能写小工具,写自动化用例这类要求对鹅厂的测试人员来说都是一些基础的必备素质,但是一个优秀的测试,也是有着一颗开发完美测试工具的心的.但是罗马不是一天构建成,特别是 ...

  4. FreeMarker 教程整理

    Freemarker新手教程 http://blog.csdn.net/qq_23994787/article/details/77506980   FreeMarker教程整理 http://blo ...

  5. ADO.NET 五(DataAdapter 与 DataSet)

    在执行对表中数据的查询时还能将数据保存到 DataSet 中,但需要借助 DataAdapter 类来实现. 在实际应用中,DataAdapter 与 DataSet 是在查询操作中使用最多的类. 此 ...

  6. 使用springboot实现一个简单的restful crud——01、项目简介以及创建项目

    前言 之前一段时间学习了一些springboot的一些基础使用方法和敲了一些例子,是时候写一个简单的crud来将之前学的东西做一个整合了 -- 一个员工列表的增删改查. 使用 restful api ...

  7. webRTC client 源码环境工具配置

    以下操作真实实验过,安卓,苹果均可成功 环境 Mac 10.13.6 Xcode 11 翻墙代理:Lantern 专业版 Python 2.7.10 设置 git 代理 #设置git代理 $ git ...

  8. python进程不能并行的原因,进程阻塞

    上图红色框的写法进程会阻塞,并不能实现多进程.这种写法不需要调用start方法也会执行. 注意:正常写法是上图红框下面的代码,即可实现多进程.

  9. spring事务什么时候会自动回滚

    在java中异常的基类为Throwable,他有两个子类xception与Errors.同时RuntimeException就是Exception的子类,只有RuntimeException才会进行回 ...

  10. CentOS7.x安装Java

    1.在甲骨文注册帐号下载需要版本的java的源码包 https://www.oracle.com/java/technologies/jdk12-downloads.html 2.把下载好的jdk的源 ...