redis在.Net程序中使用

摘要:
1.设置访问密码configsetrequirepass1234562.连接redis服务器privatestaticstringredisHost=ConfigHelper.GetAppSetting("redisHost");privatestaticintredisPort=ConfigHelper.GetAppSetting("redisPort").AsInt32();privatest
1.设置访问密码
config set requirepass 123456 
2.连接redis服务器
 private static string redisHost = ConfigHelper.GetAppSetting("redisHost");
 private static int redisPort = ConfigHelper.GetAppSetting("redisPort").AsInt32();
 private static string redisPass = ConfigHelper.GetAppSetting("redisPass");
 private static RedisClient redis = new RedisClient(redisHost, redisPort, redisPass);
可能遇到的问题:
1.如果报如下错误:
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
可能就是因为没有设置访问密码
2.如果无法连接redis服务器,可能是因为端口的问题:
/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT
如果都设置好了还报错,稍等一会即可
3.NOAUTH Authentication required.
auth 123456:重新设置访问密码即可
redis在.Net程序中使用第1张
redis在.Net程序中使用第2张
redis在.Net程序中使用第3张
redis在.Net程序中使用第4张

免责声明:文章转载自《redis在.Net程序中使用》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇springboot + spring cloudeurekamac 安装配置 tomcat下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

redis-cluster集群安装(基于redis-3.2.10)

上节主要演示了redis单节点的安装部署,对于数据量更大的服务可以安装redis-cluster进行处理 1. 安装ruby yum install ruby ruby-devel rubygems rpm-build -y rpm -qa|grepruby ruby -v 2.安装redis-cluster gem install redis --v...

使用Redis分布式锁处理并发,解决超卖问题

一、使用Apache ab模拟并发压测 1、压测工具介绍 $ ab -n 100 -c 100 http://www.baidu.com/ -n表示发出100个请求,-c模拟100个并发,相当是100个人同时访问。 还可以这样写: $ ab -t 60 -c 100 http://www.baidu.com/ -t表示60秒,-c是100个并发,会在连续6...

9.Redis详解(九)------ 哨兵(Sentinel)模式详解

在上一篇博客----Redis详解(八)------ 主从复制,我们简单介绍了Redis的主从架构,但是这种主从架构存在一个问题,当主服务器宕机,从服务器不能够自动切换成主服务器,为了解决这个问题,我们又介绍了哨兵模式,本篇博客我们继续深入的介绍一下这种模式. 1、架构图 2、服务器列表 3、搭建主从模式 ①、主要配置项 主服务器(上图的Node1)配...

详解Session分布式共享(.NET CORE版)

一、前言&回顾        在上篇文章Session分布式共享 = Session + Redis + Nginx中,好多同学留言问了我好多问题,其中印象深刻的有:nginx挂了怎么办?采用Redis的Session方案与微软Session方案相比,有什么优势呢?Cookie也可以取代Session的,采用Redis的Session方案优势在哪...

操作系统内存大页(THP)对redis性能的影响

目录 THP THP对redis的影响 关闭THP redis启动日志的warning: WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues...

RedisDump安装以及常见错误

安装redisdump大部分问题都出在版本的问题,redis-dump是将redis和json互转的工具;redis-dump是基于ruby开发,需要ruby环境,而且新版本的redis-dump要求2.3.0及以上的ruby版本,centos中yum只能安装2.0版本的ruby。需要先安装ruby的管理工具rvm安装高版本的ruby。 rvm安装以及常见...