Recently, two sets of environments have been deployed in Tianyi cloud and Huawei Cloud respectively due to work needs. Redis is used in both projects, and the deployment process of REDis is recorded here. This paper introduces the redIS standalone installation on CentOS 6.10, and the following redIS standalone installation and deployment are all based on RedIS.

Downloading the Installation package

IO, you can see that the latest stable version of Redis is 6.0.9. The version we used in the actual project was Redis 4.0.14.

Open the download. Redis. IO/releases the link can see all versions of redis.

#Create a directory
mkdir -p /opt/software
cd /opt/software
#Download the Redis installation packageWget HTTP: / / https://download.redis.io/releases/redis-4.0.14.tar.gzCopy the code

Directory planning and installation

#Creating a data directory
mkdir -p /data/redis_cluster/redis_6379

#Create a directory
mkdir -p /opt/redis_cluster/redis_6379/{conf,pid,logs}

#Unpack theTar -zxvf /opt/software/redis-4.0.14.tar.gz -c /opt/redis_cluster#Creating soft LinksLn -s/opt/redis_cluster/redis - 4.0.14 / opt/redis_cluster/redis#The installation
cd /opt/redis_cluster/redis
make && make install
Copy the code

Problems you might encounter

make[3]: Entering directory '/opt/redis_cluster/redis-4.0.14/deps/hiredis' gcc-std = c99-pedantic-c-O3-fIC-wall-w -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c make[3]: gcc: Command not found make[3]: *** [net.o] Error 127 make[3]: Leaving directory '/opt/redis_cluster/redis-4.0.14/deps/hiredis' make[2]: *** [hiredis] Error 2 make[2]: Leaving directory '/opt/redis_cluster/ redIS-4.0.14 /deps' make[1]: [persist-settings] Error 2 (ignored) CC adlist.o /bin/sh: cc: command not found make[1]: *** [adlist.o] Error 127 make[1]: Leaving directory '/opt/redis_cluster/redis-4.0.14/ SRC' make: *** [all] Error 2Copy the code

The GCC environment needs to be installed

yum -y install gcc
Copy the code

recompile

make distclean
make && make install
Copy the code

Modify the configuration

vi /opt/redis_cluster/redis_6379/conf/redis_6379.conf
Copy the code

The following

#Start in daemon mode
daemonize yes
#IP address of the bound hostThe bind 192.168.56.105#Listen on port
port 6379
#The pid file andlogSave address of the file
pidfile /opt/redis_cluster/redis_6379/pid/redis_6379.pid
logfile /opt/redis_cluster/redis_6379/logs/redis_6379.log
#Set the number of databases. Default is 0
databases 16
#Specifies the name of the local persistence file, dump.rdb by default
dbfilename redis_6379.rdb
#Directory for local data
dir /data/redis_cluster/redis_6379

# RDB
save 900 1
save 300 10
save 60 10000

# AOF
appendonly yes
appendfsync everysec
appendfilename "appendonly.aof"
Copy the code

Start the redis server. –

redis-server /opt/redis_cluster/redis_6379/conf/redis_6379.conf
Copy the code

View the Redis process

ps -ef|grep redis
Copy the code

Client connection

Run the redis-cli command to connect to redis-server

[root@centos redis]# redis-cli -h 192.168.56.105
192.168.56.105:6379> set hello redis
OK
192.168.56.105:6379> get hello
"redis"
192.168.56.105:6379> 
Copy the code

At this point, the Redis standalone installation and deployment is complete. If you encounter problems during installation, please leave a message.