Installation et déploiement de Redis (environnement CentOS7, Redis 6.0.9)

 

table des matières

 

1. Site officiel de Redis

Deuxièmement, installez Redis

1. Décompressez

2. Compilez le code source

3. Installation

Troisièmement, déployez Redis

1. Créez des dossiers bin et etc.

2. Déplacer des fichiers

Quatrièmement, lancez Redis


1. Site officiel de Redis

https://redis.io/download

Cet article utilise la dernière version stable V6.0.9

Deuxièmement, installez Redis

1. Décompressez

tar -zxf redis-6.0.9.tar.gz

2. Compilez le code source

Fabriquer

Remarque: une erreur peut être signalée pendant le processus de création, le message d'erreur est le suivant

In file included from server.c:30:0:
server.h:1072:5: error: expected specifier-qualifier-list before ‘_Atomic’
     _Atomic unsigned int lruclock; /* Clock for LRU eviction */
     ^
server.c: In function ‘serverLogRaw’:
server.c:1031:31: error: ‘struct redisServer’ has no member named ‘logfile’
     int log_to_stdout = server.logfile[0] == '\0';
                               ^
server.c:1034:23: error: ‘struct redisServer’ has no member named ‘verbosity’
     if (level < server.verbosity) return;
                       ^
server.c:1036:47: error: ‘struct redisServer’ has no member named ‘logfile’
     fp = log_to_stdout ? stdout : fopen(server.logfile,"a");
                                               ^
server.c:1049:47: error: ‘struct redisServer’ has no member named ‘timezone’
         nolocks_localtime(&tm,tv.tv_sec,server.timezone,server.daylight_active);
                                               ^
........

La raison de l'erreur: la version GCC est faible, la nouvelle version de Redis utilise c11, la version par défaut du système est 4.8.5

[root@10 redis-6.0.9]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Solution: besoin de mettre à jour gcc vers la version 5.4 ou supérieure, la commande d'installation est la suivante

yum groupinstall "Outils de développement"

chaînes /usr/lib64/libstdc++.so.6 | grep GLIBC

cd / usr / local / src /

wget http://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz // La vitesse est lente, utilisez la station miroir: wget http: //mirror.hust .edu .cn / gnu / gcc / gcc-10.2.0 / gcc-10.2.0.tar.gz

tar -zxf gcc-10.2.0.tar.gz

cd gcc-10.2.0

./contrib/download_prerequisites

./configure -enable-checking = release -enable-languages ​​= c, c ++ -disable-multilib

faire -j4

ls / usr / local / bin | grep gcc

faire installer

En raison de la lenteur du processus d'installation, une autre façon de mettre à niveau:

yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c ++ devtoolset-9-binutils
scl enable devtoolset-9 bash
echo "source / opt / rh / devtoolset-9 / enable" >> / etc / profile
gcc -v

3. Installation

faire installer

[root@10 redis-6.0.9]# cd src/
[root@10 src]# make install

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install

Troisièmement, déployez Redis

1. Créez des dossiers bin et etc.

[root @ 10 redis-6.0.9] # mkdir etc
[root @ 10 redis-6.0.9] # mkdir bin


2. Déplacer des fichiers

[root @ 10 src] # mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server ../bin/
[root @ 10 src] # cd ../bin/
[root @ 10 bin] # ls
mkreleasehdr.sh redis-check-aof redis-cli
redis-benchmark redis-check-rdb redis-server
[root @ 10 bin] # cd ..
[root @ 10 redis-6.0.9] # mv redis.conf etc /
[root @ 10 redis-6.0.9] # cd etc
[root @ 10 etc] # ls
redis.conf

Quatrièmement, lancez Redis

[root@10 bin]# ./redis-server
13660:C 05 Dec 2020 11:57:20.929 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13660:C 05 Dec 2020 11:57:20.929 # Redis version=6.0.9, bits=64, commit=00000000                                                      , modified=0, pid=13660, just started
13660:C 05 Dec 2020 11:57:20.929 # Warning: no config file specified, using the                                                       default config. In order to specify a config file use ./redis-server /path/to/re                                                      dis.conf
13660:M 05 Dec 2020 11:57:20.931 * Increased maximum number of open files to 100                                                      32 (it was originally set to 1024).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.0.9 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 13660
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

13660:M 05 Dec 2020 11:57:20.934 # WARNING: The TCP backlog setting of 511 canno                                                      t be enforced because /proc/sys/net/core/somaxconn is set to the lower value of                                                       128.
13660:M 05 Dec 2020 11:57:20.934 # Server initialized
13660:M 05 Dec 2020 11:57:20.936 # WARNING overcommit_memory is set to 0! Backgr                                                      ound save may fail under low memory condition. To fix this issue add 'vm.overcom                                                      mit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl v                                                      m.overcommit_memory=1' for this to take effect.
13660:M 05 Dec 2020 11:57:20.937 # WARNING you have Transparent Huge Pages (THP)                                                       support enabled in your kernel. This will create latency and memory usage issue                                                      s with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/t                                                      ransparent_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 disab                                                      led (set to 'madvise' or 'never').
13660:M 05 Dec 2020 11:57:20.937 * Ready to accept connections

 

 

 

 

 

Je suppose que tu aimes

Origine blog.csdn.net/xlyrh/article/details/110729261
conseillé
Classement