CentOS7源码安装redis6
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 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
4.启动redis
[root@localhost redis-6.2.8]# /usr/local/redis/bin/redis-server 38098:C 03 Jan 2023 18:07:02.299 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 38098:C 03 Jan 2023 18:07:02.299 # Redis version=6.2.8, bits=64, commit=00000000, modified=0, pid=38098, just started 38098:C 03 Jan 2023 18:07:02.299 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/local/redis/bin/redis-server /path/to/redis.conf 38098:M 03 Jan 2023 18:07:02.299 * monotonic clock: POSIX clock_gettime _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 6.2.8 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 38098 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | https://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 38098:M 03 Jan 2023 18:07:02.300 # Server initialized 38098:M 03 Jan 2023 18:07:02.300 # 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. 38098:M 03 Jan 2023 18:07:02.300 * Loading RDB produced by version 6.2.8 38098:M 03 Jan 2023 18:07:02.300 * RDB age 207 seconds 38098:M 03 Jan 2023 18:07:02.300 * RDB memory usage when created 0.77 Mb 38098:M 03 Jan 2023 18:07:02.300 # Done loading RDB, keys loaded: 0, keys expired: 0. 38098:M 03 Jan 2023 18:07:02.300 * DB loaded from disk: 0.000 seconds 38098:M 03 Jan 2023 18:07:02.300 * Ready to accept connections ^C38098:signal-handler (1672740433) Received SIGINT scheduling shutdown... 38098:M 03 Jan 2023 18:07:14.024 # User requested shutdown... 38098:M 03 Jan 2023 18:07:14.024 * Saving the final RDB snapshot before exiting. 38098:M 03 Jan 2023 18:07:14.025 * DB saved on disk 38098:M 03 Jan 2023 18:07:14.025 # Redis is now ready to exit, bye bye...
解决警告信息:
# 第一个警告的解决方法 echo net.core.somaxconn=511 >> /etc/sysctl.conf # 第二个警告的解决方法 echo vm.overcommit_memory=1 >> /etc/sysctl.conf # 使/etc/sysctl.conf生效 sysctl -p # 第三个警告的解决方法 echo never > /sys/kernel/mm/transparent_hugepage/enabled
重新启动redis,正常
[root@localhost redis-6.2.8]# /usr/local/redis/bin/redis-server 38105:C 03 Jan 2023 18:07:34.937 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 38105:C 03 Jan 2023 18:07:34.937 # Redis version=6.2.8, bits=64, commit=00000000, modified=0, pid=38105, just started 38105:C 03 Jan 2023 18:07:34.937 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/local/redis/bin/redis-server /path/to/redis.conf 38105:M 03 Jan 2023 18:07:34.938 * monotonic clock: POSIX clock_gettime _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 6.2.8 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 38105 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | https://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 38105:M 03 Jan 2023 18:07:34.939 # Server initialized 38105:M 03 Jan 2023 18:07:34.939 * Loading RDB produced by version 6.2.8 38105:M 03 Jan 2023 18:07:34.939 * RDB age 20 seconds 38105:M 03 Jan 2023 18:07:34.939 * RDB memory usage when created 0.77 Mb 38105:M 03 Jan 2023 18:07:34.939 # Done loading RDB, keys loaded: 0, keys expired: 0. 38105:M 03 Jan 2023 18:07:34.939 * DB loaded from disk: 0.000 seconds 38105:M 03 Jan 2023 18:07:34.939 * Ready to accept connections ^C38105:signal-handler (1672740707) Received SIGINT scheduling shutdown... 38105:M 03 Jan 2023 18:11:47.471 # User requested shutdown... 38105:M 03 Jan 2023 18:11:47.471 * Saving the final RDB snapshot before exiting. 38105:M 03 Jan 2023 18:11:47.472 * DB saved on disk
标签:Jan,-._,03,redis6,18,CentOS7,源码,2023,_.- From: https://www.cnblogs.com/haoee/p/17023052.html