redis安装以及设置密码-------------【填坑】

之前倒是有安装了redis,试了还成功了;因为是个初学者,对于redis不怎么熟悉,而且自己手头也没有这个的教程,所以就这么稀里糊涂的看网上的博文进行安装和一些简单的使用;

原redis安装目录:

妈耶,居然没有redis.conf;不知道但是我是从那篇博文看的下载步骤(不过还是感谢人家,毕竟人家也是辛苦总结出来以及放了安装包滴。),都怪我年少无知。

之后我还挣扎了下,查看了一篇博文【redis 实践笔记(一)(redis.conf不起作用)】,可惜我没能成功。

 

再之后的话,我就是重新安装了redis,安装之后,目录如下图:

 

但是还是有点错误,如下图:

还好命令提示框有提示,不然又是四处找答案咯。

 

修改好后,也就完成了安装;

参考博文:【Redis(window版本)安装及使用

但是密码修改的话,就需要打开redis.windows.conf(一般网上的是redis.conf)

之后查找requirepass,删掉注释以及后面某个单词(忘记记下来了,哈哈),然后在后面删除的地方写上自己的密码;即可。

修改密码完成(比较顺利啦,我一般安装东西的时候,就是会把别人很小概率才会踩到得坑给踩完,┭┮﹏┭┮)

上面参考博文:【Redis 设置密码登录】、【redis如何修改登录密码?设置的密码为什么无效?以及如何更改端口?

 

 

 

其实之所以会出现重新安装以及配置密码的问题是因为写了个项目,而在springboot中为redis配置密码之后出现的错误,才考虑到这个问题;

下面是使用了Junit单元测试的时候出现了问题:

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	at redis.clients.util.Pool.getResource(Pool.java:53)
	at redis.clients.jedis.JedisPool.getResource(JedisPool.java:226)
	at com.imooc.smallgrocerystore.cache.JedisUtil.getJedis(JedisUtil.java:46)
	at com.imooc.smallgrocerystore.cache.JedisUtil$Keys.exists(JedisUtil.java:204)
	at com.imooc.smallgrocerystore.service.impl.AreaServiceImpl.getAreaList(AreaServiceImpl.java:51)
	at com.imooc.smallgrocerystore.service.impl.AreaServiceImpl$$FastClassBySpringCGLIB$$960cf122.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.imooc.smallgrocerystore.service.impl.AreaServiceImpl$$EnhancerBySpringCGLIB$$d3cf551.getAreaList(<generated>)
	at com.imooc.smallgrocerystore.service.AreaServiceTest.testGetAreaList(AreaServiceTest.java:27)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
	at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Failed connecting to host 127.0.0.1:6379
	at redis.clients.jedis.Connection.connect(Connection.java:207)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:101)
	at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1844)
	at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:106)
	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:874)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:417)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:346)
	at redis.clients.util.Pool.getResource(Pool.java:49)
	... 45 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at redis.clients.jedis.Connection.connect(Connection.java:184)
	... 52 more

其实也就是没连接成功的问题,之前我一开始以为是因为redis的连接池满了,但是之后我通过扩容的来判断之后,发现不是这个;我就疑问了?这个项目也没那么大,就那么几个轮播图的图片而已,那需要这么多内存???

所以我就再次寻求度娘了(哎,开发人员对英语不熟悉就是不好啊,不然早就去看英文文档了)

之后找到一篇对于redis连接不成功的不错的博文:【SpringBoot2.0集成Redis详解及踩过的坑(Could not get a resource from the pool)

找到了原因所在。┭┮﹏┭┮

对了还有一篇博文:【redis JedisConnectionException: Could not get a resource from the pool 的八种可能的原因

 

推荐redis书籍:【redis开发与运维】

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值