Linux(Centos 7)安装redis 4.0

在linux 系统中安装redis 4.0。


1 下载安装包与依赖工具

我们需要下载redis 的官方安装包。

  • 官方地址

由于redis 是基于C 语言编译,所以我们需要安装gcc 工具。

[root@localhost ~]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz
[root@localhost ~]# sudo yum -y install gcc

等待安装完毕即可

2 进行安装与运行

接下来我们将安装包解压,并执行安装过程。

[root@localhost ~]# tar -xzvf redis-4.0.11.tar.gz
[root@localhost ~]# cd redis-4.0.11
[root@localhost redis-4.0.11]# make

等待安装完毕即可。
启动方法:

[root@localhost redis-4.0.11]# ./src/redis-server ./redis.conf

指定安装路径可在安装时输入make PREFIX?=/usr/local install
即可将命令安装到/usr/local/bin 下。

[root@localhost bin]# ll
总用量 11540
-rw-r--r--. 1 root root      93 96 20:06 dump.rdb
-rwxr-xr-x. 1 root root  353728 96 19:58 redis-benchmark
-rwxr-xr-x. 1 root root 3645344 96 19:58 redis-check-aof
-rwxr-xr-x. 1 root root 3645344 96 19:58 redis-check-rdb
-rwxr-xr-x. 1 root root  519936 96 19:58 redis-cli
lrwxrwxrwx. 1 root root      12 9月   6 19:58 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 3645344 96 19:58 redis-server

其他命令就不予细说了,我们了解一下redis-sentinel 这个
可以启动守护进程,但是需要携带配置文件路径。

[root@localhost bin]# ./redis-sentinel 
9244:X 06 Sep 20:42:59.782 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9244:X 06 Sep 20:42:59.783 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=9244, just started
9244:X 06 Sep 20:42:59.783 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-sentinel /path/to/sentinel.conf
9244:X 06 Sep 20:42:59.784 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.11 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in sentinel mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 26379
 |    `-._   `._    /     _.-'    |     PID: 9244
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

9244:X 06 Sep 20:42:59.785 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
9244:X 06 Sep 20:42:59.785 # Sentinel started without a config file. Exiting...

如果不携带配置文件会看到控制台最后输出了一行叫做without a config file. ,可在启动的时候携带上刚刚的redis.conf 配置文件即可启动守护进程。

你可能感兴趣的:(linux)