zl程序教程

您现在的位置是:首页 >  系统

当前栏目

Linux下安装Redis服务

2023-09-27 14:21:42 时间

http://redis.io/download
https://github.com/antirez/redis
http://www.oschina.net/p/redis

#安装配置
wget
http://download.redis.io/releases/redis-2.8.12.tar.gz
tar xzf redis-2.8.12.tar.gz
cd redis-2.8.12
make
redis-server /etc/redis.conf 
#启动redis服务
[root@localhost opt]# redis-server /opt/software/redis-2.8.12/redis.conf

[26721] 24 Jun 15:13:49.440 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                 
           _.-``__ ''-._                                            
      _.-``    `.  `_.  ''-._           Redis 2.8.12 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
(    '      ,       .-`  | `,    )     Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
|    `-._   `._    /     _.-'    |     PID: 26721
  `-._    `-._  `-./  _.-'    _.-'                                  
|`-._`-._    `-.__.-'    _.-'_.-'|                                 
|    `-._`-._        _.-'_.-'    |          
http://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                  
|`-._`-._    `-.__.-'    _.-'_.-'|                                 
|    `-._`-._        _.-'_.-'    |                                 
  `-._    `-._`-.__.-'_.-'    _.-'                                  
      `-._    `-.__.-'    _.-'                                      
          `-._        _.-'                                          
              `-.__.-'                                              

[26721] 24 Jun 15:13:49.441 # Server started, Redis version 2.8.12
[26721] 24 Jun 15:13:49.441 # 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.
[26721] 24 Jun 15:13:49.441 * The server is now ready to accept connections on port 6379
se
[1]+  Stopped                 redis-server /opt/software/redis-2.8.12/redis.conf
[root@localhost opt]# ps -ef | grep redis
root     26721 22675  0 15:13 pts/1    00:00:00 redis-server *:6379                              
root     27106 22675  0 15:21 pts/1    00:00:00 grep redis

#查看服务
ps -ef | grep redis

#测试服务
127.0.0.1:6379> set test haha
OK
127.0.0.1:6379> get test
"haha"

#关闭redis服务
redis-cli shutdown
#客户端
https://github.com/xetorthio/jedis
https://github.com/taobao/tedis
#其他命令
    redis-server ,redis-cli,redis-benchmark,redis-stat,作用如下:
    redis-server Redis服务器的daemon启动程序
    redis-cli Redis命令行操作工具。当然,你也可以用telnet根据其纯文本协议来操作
    redis-benchmark Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能
    redis-stat Redis状态检测工具,可以检测Redis当前状态参数及延迟状况

Linux 下 Redis 安装详解
http://www.oschina.net/question/12_18065