search
HomeDatabaseRedisHow to install redis3.2 in stand-alone environment in centos7

本次安装的系统版本如下:

[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分钟左右后执行完成无报错

How to install redis3.2 in stand-alone environment in centos7

进入到utils目录下,执行redis初始化脚本install_server.sh

 cd utils/

./install_server.sh

执行如下步骤

How to install redis3.2 in stand-alone environment in centos7

 填写端口号,以及其他的路径,如果默认则直接回车

从安装过程来看,创建了一个文件在

/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!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete
What Are the Performance Trade-offs When Choosing Redis Over a Traditional Database?What Are the Performance Trade-offs When Choosing Redis Over a Traditional Database?May 16, 2025 am 12:01 AM

RedisofferssuperiorspeedfordataoperationsbutrequiressignificantRAMandinvolvestrade-offsindatapersistenceandscalability.1)Itsin-memorynatureprovidesultra-fastread/writeoperations,idealforreal-timeapplications.2)However,largedatasetsmaynecessitatedatae

Redis vs databases: performance comparisonsRedis vs databases: performance comparisonsMay 14, 2025 am 12:11 AM

Redisoutperformstraditionaldatabasesinspeedforread/writeoperationsduetoitsin-memorynature,whiletraditionaldatabasesexcelincomplexqueriesanddataintegrity.1)Redisisidealforreal-timeanalyticsandcaching,offeringphenomenalperformance.2)Traditionaldatabase

When Should I Use Redis Instead of a Traditional Database?When Should I Use Redis Instead of a Traditional Database?May 13, 2025 pm 04:01 PM

UseRedisinsteadofatraditionaldatabasewhenyourapplicationrequiresspeedandreal-timedataprocessing,suchasforcaching,sessionmanagement,orreal-timeanalytics.Redisexcelsin:1)Caching,reducingloadonprimarydatabases;2)Sessionmanagement,simplifyingdatahandling

Redis: Beyond SQL - The NoSQL PerspectiveRedis: Beyond SQL - The NoSQL PerspectiveMay 08, 2025 am 12:25 AM

Redis goes beyond SQL databases because of its high performance and flexibility. 1) Redis achieves extremely fast read and write speed through memory storage. 2) It supports a variety of data structures, such as lists and collections, suitable for complex data processing. 3) Single-threaded model simplifies development, but high concurrency may become a bottleneck.

Redis: A Comparison to Traditional Database ServersRedis: A Comparison to Traditional Database ServersMay 07, 2025 am 12:09 AM

Redis is superior to traditional databases in high concurrency and low latency scenarios, but is not suitable for complex queries and transaction processing. 1.Redis uses memory storage, fast read and write speed, suitable for high concurrency and low latency requirements. 2. Traditional databases are based on disk, support complex queries and transaction processing, and have strong data consistency and persistence. 3. Redis is suitable as a supplement or substitute for traditional databases, but it needs to be selected according to specific business needs.

Redis: Introduction to a Powerful In-Memory Data StoreRedis: Introduction to a Powerful In-Memory Data StoreMay 06, 2025 am 12:08 AM

Redisisahigh-performancein-memorydatastructurestorethatexcelsinspeedandversatility.1)Itsupportsvariousdatastructureslikestrings,lists,andsets.2)Redisisanin-memorydatabasewithpersistenceoptions,ensuringfastperformanceanddatasafety.3)Itoffersatomicoper

Is Redis Primarily a Database?Is Redis Primarily a Database?May 05, 2025 am 12:07 AM

Redis is primarily a database, but it is more than just a database. 1. As a database, Redis supports persistence and is suitable for high-performance needs. 2. As a cache, Redis improves application response speed. 3. As a message broker, Redis supports publish-subscribe mode, suitable for real-time communication.

Redis: Database, Server, or Something Else?Redis: Database, Server, or Something Else?May 04, 2025 am 12:08 AM

Redisisamultifacetedtoolthatservesasadatabase,server,andmore.Itfunctionsasanin-memorydatastructurestore,supportsvariousdatastructures,andcanbeusedasacache,messagebroker,sessionstorage,andfordistributedlocking.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Clair Obscur: Expedition 33 - How To Get Perfect Chroma Catalysts
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

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.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.