目次
1.Redisの公式ウェブサイト
この記事では、最新の安定バージョンV6.0.9を使用しています
次に、Redisをインストールします
1.解凍します
tar -zxf redis-6.0.9.tar.gz
2.ソースコードをコンパイルします
作る
注:作成プロセス中にエラーが報告される場合があります。エラーメッセージは次のとおりです。
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);
^
........
エラーの理由:GCCバージョンが低く、Redisの新しいバージョンはc11を使用し、システムのデフォルトバージョンは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.
解決策:gccをバージョン5.4以降に更新する必要があります。インストールコマンドは次のとおりです。
yumgroupinstall「開発ツール」
文字列/ 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 //速度が遅い場合は、ミラーステーションを使用します: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
make -j4
ls / usr / local / bin | grep gcc
インストールする
インストールプロセスが遅いため、アップグレードする別の方法:
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.インストール
インストールする
[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
3、Redisをデプロイします
1.binなどのフォルダを作成します
[root @ 10 redis-6.0.9] #mkdirなど
[root @ 10 redis-6.0.9] #mkdir bin
2.ファイルを移動します
[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
第四に、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