菜鸟的redis入门之路1--连接redis客户端报错

CentOS6.5下安装了redis,想连接redis客户端查看redis的数据列表,输入命令:redis-cli,直接报错如下:

[root@xxxx]# redis-cli  
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>

查了很多资料,各种百度,都没有相关问题的解决方案,回家突然想起来redis服务不确定是不是启动,于是乎启动redist服务

 

[root@xxxx]# redis-server
13841:C 09 Aug 21:13:34.763 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                 
           _.-``__ ''-._                                            
      _.-``    `.  `_.  ''-._           Redis 3.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 13841
  `-._    `-._  `-./  _.-'    _.-'                                  
 |`-._`-._    `-.__.-'    _.-'_.-'|                                 
 |    `-._`-._        _.-'_.-'    |           http://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                  
 |`-._`-._    `-.__.-'    _.-'_.-'|                                 
 |    `-._`-._        _.-'_.-'    |                                 
  `-._    `-._`-.__.-'_.-'    _.-'                                  
      `-._    `-.__.-'    _.-'                                      
          `-._        _.-'                                          
              `-.__.-'                                              

 

13841:M 09 Aug 21:13:34.766 # Server started, Redis version 3.0.3
13841:M 09 Aug 21:13:34.767 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13841:M 09 Aug 21:13:34.767 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13841:M 09 Aug 21:13:34.767 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

 

但是,直接执行redis server,我不能在这个命令行界面再输入其他的命令,使用Ctrl+C退出,则redis服务也就停了,提示如下:

 

13841:signal-handler (1470748417) Received SIGINT scheduling shutdown...
13841:M 09 Aug 21:13:37.070 # User requested shutdown...
13841:M 09 Aug 21:13:37.070 * Saving the final RDB snapshot before exiting.
13841:M 09 Aug 21:13:37.074 * DB saved on disk
13841:M 09 Aug 21:13:37.075 # Redis is now ready to exit, bye bye...

 

楼主又想起同事之前教过的,可以忽略输入输出执行命令,于是nohup redis-server &,然后再执行redis-cli,搞定!!!

 

[root@xxxx]# nohup redis-server &
[1] 6191
[root@xxxx]# nohup: ignoring input and appending output to `nohup.out'

 

[root@xxxx]# redis-cli
127.0.0.1:6379>

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值