本次安装的系统版本如下:
[root@zhangqinglei ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@zhangqinglei ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-
noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarchDistributor ID: CentOS
Description: CentOS Linux release 7.5.1804 (Core)
Release: 7.5.1804
Codename: Core
因不同的系统版本会存在一些差异,因此记录比对。后续针对centos其他版本测试安装说明。
本次安装的redis版本如下
redis-3.2.13.tar.gz
安装在一台服务器,并且分别提供不同的端口。以及针对redis的卸载进行说明。
目录:
安装目录:/home/soft
工具目录:/home/tools
rz上传到工具目录,redis-3.2.13.tar.gz
解压到soft目录
tar -zxvf redis-3.2.13.tar.gz -C /home/soft/
cd /home/soft/
改名
mv redis-3.2.13 redis3-6379
表示为redis3版本,开放端口为6379
进入目录开始安装
cd redis3-6379
make && make install
等待1分钟左右后执行完成无报错

进入到utils目录下,执行redis初始化脚本install_server.sh
cd utils/
./install_server.sh
执行如下步骤

填写端口号,以及其他的路径,如果默认则直接回车
从安装过程来看,创建了一个文件在
/etc/init.d/redis_6379
查看该文件内容
#!/bin/sh#Configurations injected by install_server below....
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_6379.pid
CONF="/etc/redis/6379.conf"REDISPORT="6379"###############
# SysV Init Information
# chkconfig: - 58 74# description: redis_6379 is the redis daemon.
### BEGIN INIT INFO
# Provides: redis_6379
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Should-Start: $syslog $named
# Should-Stop: $syslog $named
# Short-Description: start and stop redis_6379
# Description: Redis daemon
### END INIT INFOcase "$1" instart)if [ -f $PIDFILE ]thenecho "$PIDFILE exists, process is already running or crashed"elseecho "Starting Redis server..."$EXEC $CONFfi;;
stop)if [ ! -f $PIDFILE ]thenecho "$PIDFILE does not exist, process is not running"elsePID=$(cat $PIDFILE)echo "Stopping ..."$CLIEXEC -p $REDISPORT shutdownwhile [ -x /proc/${PID} ]doecho "Waiting for Redis to shutdown ..."sleep 1doneecho "Redis stopped"fi;;
status)
PID=$(cat $PIDFILE)if [ ! -x /proc/${PID} ]thenecho 'Redis is not running'elseecho "Redis is running ($PID)"fi;;
restart)
$0 stop
$0 start
;;*)echo "Please use start, stop, restart or status as first argument";;esac可以得知,
启动为/etc/init.d/redis_6379 start
停止为/etc/init.d/redis_6379 stop
查看状态为/etc/init.d/redis_6379 status
redis.config默认绑定的IP为127.0.0.1,密码没有设置
安装即启动了,查看状态
[root@zhangqinglei redis3-6379]# /etc/init.d/redis_6379 status
Redis is running (8236)
当前正在运行中,进程ID为8236
进入到src目录下,使用redis-cli进行连接测试
[root@zhangqinglei src]# ./redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> set first 1
OK
127.0.0.1:6379> get first
“1”
127.0.0.1:6379> keys *
1) “first”
使用exit退出。至此成功安装。
The above is the detailed content of How to install redis3.2 in stand-alone environment in centos7. For more information, please follow other related articles on the PHP Chinese website!
How to retrieve a range of members by their rank (index) using ZRANGE?Aug 26, 2025 am 04:49 AMThe ZRANGE command is used to obtain a subset from an ordered set based on the ranking of members, and the ranking starts at 0. When using it, specify the starting and end rankings (both included), such as ZRANGEplayers04 obtains the top 5 players; add WITHSCORES parameters to return scores at the same time; support negative indexes, such as ZRANGEplayers-3-1 obtains the last three members; suitable for scenarios such as ranking, paging, and real-time dashboards; note that no errors will be reported when processing index values beyond the range, and the results will be returned in ascending order by default.
How Does Redis Scale Differently Than Traditional Databases?Aug 26, 2025 am 02:15 AMRedisscalesdifferentlyfromtraditionaldatabasesthroughin-memoryoperations,sharding,andreplication.1)In-memoryoperationsallowRedistohandlehigh-speedread/writetasks.2)Shardingdistributesdataacrossmultipleinstancesforhorizontalscaling.3)Replicationensure
What are some practical use cases for Redis Bitmaps?Aug 25, 2025 pm 03:29 PMRedisBitmapsareidealfortrackingbinarystatesatscale.1.Foruseractivitytracking,eachuser'sdailyloginisstoredasabitintheirkey,enablingefficientcomputationofstreaksandretention.2.Featureflagscanbemanagedbyassigningbitstousers,allowingfastandscalableA/Btes
What is connection pooling and why is it important for Redis clients?Aug 25, 2025 pm 02:16 PMConnectionpoolingisessentialforRedisclientsinhigh-trafficapplicationstoreduceoverhead,limitresourceusage,andimprovescalability.1.Itworksbyreusingasetofpre-establishedconnectionsinsteadofcreatingnewonesforeachrequest.2.Thisreducesnetworklatencyfromrep
What is read-only mode on replicas (replica-read-only)?Aug 25, 2025 pm 01:22 PMAdatabasereplicaissettoread-onlymodetopreventunintendedorunauthorizedwriteoperations,ensuringdataconsistencyacrossthereplicationsetup.Thismodeallowsreplicastoprocessonlyreadqueries,avoidingdatadriftbyblockinginserts,updates,ordeletesthatcouldleadtoco
What is the difference between EVAL and EVALSHA?Aug 25, 2025 pm 12:06 PMEVAL is used to send new scripts for the first time, and EVALSHA is used to perform cached scripts efficiently. EVAL sends a complete script every time, suitable for one-time or test scenarios; EVALSHA calls cached scripts through SHA1 hash to reduce bandwidth consumption, and is suitable for frequently executed scripts; if the hash is not cached when using EVALSHA, a NOSCRIPT error will be triggered, and then fallback to EVAL should be reloaded; Redis permanently caches scripts by default, and the cache must be cleared or reloaded when updating scripts to ensure that the latest version is used.
How to perform a live migration of data from one Redis instance to another?Aug 24, 2025 pm 12:50 PMYes,Redisdatacanbemigratedbetweeninstanceswithoutdowntimebyfollowingalivemigrationprocess.1.PreparebothRedisinstancesbyensuringcompatibility,sufficientmemory,authentication/TLSsetup,anddisablingautomaticevictionpolicies.2.Performinitialsyncusingredis
How to set an expiration time (TTL) on a Redis key?Aug 24, 2025 am 09:44 AMThere are the following methods to set the TTL (survival time) of the Redis key: 1. Use the EXPIRE command, first create the key and then set the expired seconds, such as SETmykey "hello" followed by EXPIREmykey60; 2. Directly specify the EX or PX options in the SET command to set the expiration time of seconds or milliseconds respectively, such as SETmykey "hello" EX60; 3. Re-execute EXPIRE on the existing key with TTL to update the expiration time, and the old timer will be reset; 4. Use the PERSIST command to remove the TTL of the key to make it permanent; 5. Use the TTL or PTTL command to view the remaining survival time of the key, respectively


Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment






