As we know, Redis is an open-source, BSD-licensed, memory-based, key-valued storage NoSQL database. Redis is often considered a data structure server, because Redis supports string strings, hash hashes, list lists, set sets, ordered set sorted sets, and so on. Redis also supports data types such as transaction transitions, publishing, and subscriptions. In view of this, Redis is often considered to be a more powerful memcache.
This article mainly describes the Redis in the CentOS 7 environment in the installation of what is different. Assume that the CentOS 7 server is ready.
1. Enable Epel Warehouse
# # Rhel/centos 7 64-bit #
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# RPM-IVH epel-release-7-5.noarch.rpm
To verify that the Epel warehouse was established successfully, you can perform:
2, through the Yum installation Redis
# yum-y Update
# yum install Redis Php-pecl-redis
Add Redis to the boot service:
# Systemctl start Redis-server.service
# Systemctl Enable Redis-server.service
Check to see if Redis is running:
# Systemctl Is-active Redis-server.service
3, install the Redis Web Management client
Phpredisadmin is a free and open source Redisweb management client that provides a simple interface to manage the Redis database.
# git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
# CD phpredisadmin/includes
# CP config.sample.inc.php config.inc.php
To ensure that the configuration is correct:
The Redisadmin configuration file is added to the Apache server, and the contents of the file are as follows:
### nano/etc/httpd/conf.d/redisadmin.conf
### Now add the following ###
#
Web Interface for redisadmin
#
<directory "/downloads/phpredisadmin/" > Order
deny,allow Deny to all
Allow from
127.0.0.1
Allow from <your ipaddress>
</Directory>
alias/redisadmin/downloads/phpredisadmin
Alias/redisadmin/downloads/phpredisadmin
Create a bash script to make sure that the Redis is functioning as follows:
### nano/scripts/redis-check.sh
#!/bin/bash
ps=$ (which PS)
grep=$ (which GREP)
when=$ (date + "% y-%m-%d-%h:%m:%s ")
if! $PS aux | $GREP" redis.conf "| $GREP-v GREP 2>&1 >/dev/null; then
/etc/init. D/redis Restart
echo ' restarted Redis @ ' $WHEN
fi
#Check Second instance
if! $PS aux | $GREP "Redis2. Conf "| $GREP-v GREP 2>&1 >/dev/null; Then
/etc/init.d/redis2 restart
echo ' restarted Redis2 @ ' $WHEN
fi
Make sure that the script is executable:
# chmod +x/scripts/redis-check.sh
Timer cron is used to guarantee the execution of the script, run once every 3 minutes:
### nano/var/spool/cron/root */3 * * * * *
/bin/bash/script/redis-check.sh >>/var/log/redis-check.log
OK, this is finished.
Original link: http://blog.csdn.net/chszs/article/details/51925378
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.