CentOS7源码安装redis6

CentOS7源码安装redis6

redis官网下载地址:

https://redis.io/download/

1.下载源码包

[root@localhost ~]# wget https://download.redis.io/releases/redis-6.2.8.tar.gz

2.安装依赖

  redis6需要gcc高版本

[root@localhost ~]# yum -y install centos-release-scl 
[root@localhost ~]# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
[root@localhost ~]# scl enable devtoolset-9 bash (临时启用)
[root@localhost ~]# echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile (永久启用)

3.解压安装

[root@localhost ~]# tar -xvf redis-6.2.8.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/redis-6.2.8/
[root@localhost ~]# make  && make install
# redis-server在src目录下 [root@localhost redis
-6.2.8]# find src -type f -executable -print src/mkreleasehdr.sh src/redis-trib.rb src/redis-server src/redis-sentinel src/redis-cli src/redis-benchmark src/redis-check-rdb src/redis-check-aof

 4.启动redis

[root@localhost redis-6.2.8]# /usr/local/redis-6.2.8/src/redis-server 
18489:C 03 Apr 2024 18:37:02.105 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
18489:C 03 Apr 2024 18:37:02.105 # Redis version=6.2.8, bits=64, commit=00000000, modified=0, pid=18489, just started
18489:C 03 Apr 2024 18:37:02.105 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/local/redis-6.2.8/src/redis-server /path/to/redis.conf
18489:M 03 Apr 2024 18:37:02.106 * Increased maximum number of open files to 10032 (it was originally set to 1024).
18489:M 03 Apr 2024 18:37:02.106 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 18489
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

18489:M 03 Apr 2024 18:37:02.107 # Server initialized
18489:M 03 Apr 2024 18:37:02.107 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. 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.
18489:M 03 Apr 2024 18:37:02.108 * Ready to accept connections

解决警告信息:

[root@localhost redis-6.2.8]# echo vm.overcommit_memory=1 >> /etc/sysctl.conf
# 使/etc/sysctl.conf生效
[root@localhost redis-6.2.8]# sysctl -p

重新启动redis,正常 

[root@localhost redis-6.2.8]# /usr/local/redis-6.2.8/src/redis-server 
18503:C 03 Apr 2024 18:40:12.529 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
18503:C 03 Apr 2024 18:40:12.529 # Redis version=6.2.8, bits=64, commit=00000000, modified=0, pid=18503, just started
18503:C 03 Apr 2024 18:40:12.529 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/local/redis-6.2.8/src/redis-server /path/to/redis.conf
18503:M 03 Apr 2024 18:40:12.529 * Increased maximum number of open files to 10032 (it was originally set to 1024).
18503:M 03 Apr 2024 18:40:12.529 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 18503
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

18503:M 03 Apr 2024 18:40:12.530 # Server initialized
18503:M 03 Apr 2024 18:40:12.530 * Loading RDB produced by version 6.2.8
18503:M 03 Apr 2024 18:40:12.530 * RDB age 19 seconds
18503:M 03 Apr 2024 18:40:12.530 * RDB memory usage when created 0.77 Mb
18503:M 03 Apr 2024 18:40:12.530 # Done loading RDB, keys loaded: 0, keys expired: 0.
18503:M 03 Apr 2024 18:40:12.530 * DB loaded from disk: 0.000 seconds
18503:M 03 Apr 2024 18:40:12.530 * Ready to accept connections

 

posted @ 2023-01-03 18:06  Noleaf  阅读(607)  评论(0)    收藏  举报