redis集群搭建

下载Redis指定版本的源码压缩包到当前目录。

 wget http://download.redis.io/releases/redis-3.0.7.tar.gz

解压缩Redis源码压缩包。

o/releases/redis-3.0.7.tar.gz
建立一个redis目录的软连接,指向redis-3.0.7。

ln -s redis-3.0.7 redis

进入redis目录。

cd redis

编译(编译之前确保操作系统已经安装gcc)安装。

make  make install 

这里有两点要注意:第一,第3步中建立了一个redis目录的软链接,这样做是为了不把redis目录固定在指定版本上,有利于Redis未来版本升级,算是安装软件的一种好习惯。

redis-cli -v  #查看版本

配置、启动、操作、关闭Redis

表1-2 Redis可执行文件说明

可执行文件作用
redis-server启动redis服务
redis-cliredis命令行客户端
redis-benchmarkredis基准测试工具
redis-check-aofredis ao持久化文件检测和修复工具
redis-check-dumpredis rdb 持久化文件检测和修复工具
redis-sentinel启动redis sentinel
[root@master redis]# redis-se
redis-sentinel  redis-server    
[root@master redis]# redis-server 
42726:C 11 Sep 22:12:06.137 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
42726:M 11 Sep 22:12:06.138 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 42726
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

42726:M 11 Sep 22:12:06.140 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
42726:M 11 Sep 22:12:06.140 # Server started, Redis version 3.0.7
42726:M 11 Sep 22:12:06.140 # 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.
42726:M 11 Sep 22:12:06.140 # 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.
42726:M 11 Sep 22:12:06.140 * The server is now ready to accept connections on port 6379

可以看到直接使用redis-server启动Redis后,会打印出一些日志,通过日志可以看到一些信息,上例中可以看到:当前的Redis版本的是3.0.7。Redis的默认端口是6379。

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值