Installation of Redis database in CentOS 7 environment _redis

Source: Internet
Author: User
Tags redis centos git clone install redis yum repolist

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:

# yum Repolist

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:

# Nano config.inc.php

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.