Centos7 mounting the Redis (single)

Environment: centos7.6

 

Installation wget
yum the install wget -Y

安装gcc
yum -y install gcc automake autoconf libtool make

下载redis
cd /usr/local/software
wget http://download.redis.io/releases/redis-4.0.0.tar.gz

Extracting
tar -xzvf redis-4.0.0.tar.gz

Switching to a program directory
cd redis-4.0.0

Execute make to compile Redis:
make MALLOC = libc
Note: After the make command to compile complete, will generate six executable files in the src directory, are redis-server, redis-cli, redis-benchmark, redis-check-aof, redis-check-rdb, redis- sentinel.

安装Redis:
make install


Configuration Redis:
vim redis.conf
as a background process started:
the daemonize no no yes to the
set redis remote connection:
The bind 127.0.0.1 instead bind 0.0.0.0 or comment on the line
set redis connection Password:
Search requirepass the line then add in a suitable position disposed
requirepass yourpassword

Test whether the installation is successful
./src/redis-server ./redis.conf


Boot configuration:

Since the implementation of the above, we redis process is started by ps -ef | grep redis redis view the process and kill with a kill -9 process id

Redis.service file created in the service directory
vim /usr/lib/systemd/system/redis.service

[Unit]
Description=redis_server
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/software/redis-4.0.0/src/redis-server /usr/local/software/redis-4.0.0/redis.conf
ExecReload=/usr/local/software/redis-4.0.0/src/redis-server -s reload
ExecStop=/usr/local/software/redis-4.0.0/src/redis-server -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Set boot
systemctl enable redis

Start Service
systemctl start redis

Stop service
systemctl stop redis

Restart service
systemctl restart redis

Check the service status
systemctl status redis


Designated port open
Firewall-cmd = --zone public --add-Port = 6379 / TCP --permanent
Firewall-cmd --reload

Redis client can verify that the connection means connectable

 

Guess you like

Origin www.cnblogs.com/zengnansheng/p/11415282.html