Redis installation and configuration on Linux servers

Source: Internet
Author: User
Tags create directory install redis redis server

1. Download and install Redis

On the Linux server, the command line executes the following command (CD./usr LOCAL/SRC General source code is here (recommended source installation))

wget Http://download.redis.io/releases/redis-3.0.7.tar.gztar xzf redis-3.0.7.tar.gzcd redis-3.0.7make
Make all
Make install

Description

wget: Download the remote file to the local current folder.

Tar xzf: Unzip the file to the current folder directory

CD: Go to Folder

Make do all make install: Install Redis

After execution, enter the directory/usr/local/bin a few more files:

    • Redis-server:redis Server Daemon Startup program
    • Redis-cli:redis command-line operation tool. Of course, you can also use Telnet to operate on its plain text protocol.
    • Redis-benchmark:redis Performance testing tools to test the read and write performance of Redis in your system and in your configuration
    • Redis-stat:redis Status Detection Tool to detect Redis current status parameters and delay status

2. Configuring Redis

Copy configuration files (/usr/local/src/redis-3.0.7/redis.conf) to the specified directory for easy maintenance operation (/HOME/REDIS/REDIS.CONF)

Modify Redis Profile (/home/redis/redis.conf) < Below are the things you need to modify >

Daemonize yesport 6379bind 192.168.1.1 127.0.0.1logfile "/home/redis/logs/redis.log" databases 16
Dbfilename Dump.rdbdir/home/redis/data/redisdata

Note:

Daemonize:redis default is not run as daemon, can be modified by this configuration item, use Yes to enable daemon

Port: Ports

Bind: The master-slave address of the binding, usually the intranet address, the external network is not secure

LogFile: System logging (don't forget to create directory folders)

Databases: Set the number of databases, the default database is 0

Dbfilename: Specifies the local database file name, the default value is Dump.rdb

Dir: Specify the local database to hold the directory (don't forget to create the directory folder)

3. Start Redis

To start the Redis service:

    ./Redis-server (default boot)

./redis -server redis./usr/ local/bin/redis-server   /home/redis/redis.conf or   redis-server/home/redis/redis.conf 

  To see if Redis is running: Ps-ef |grep Redis

To see if the port is listening:netstat-lntp | grep 6379

Use the Redis command line (perform Redis operation command):./redis-cli

View Port Usage: NETSTAT-NLT (we've started Redis normally, Port 6379)

  

After modifying the configuration file, remember to kill the Redis process before restarting Redis, as follows:

First query the process of Pid:ps-ef |grep Redis

      

Then kill the change process: kill-9 15954

Then the command: NETSTAT-NLT see if it is still in the listening state, no longer explain the kill.

Last reboot redis:redis-server/home/redis/redis.conf

Check again to see if the restart was successful: NETSTAT-NLT

4. Testing

Start the client program REDIS-CLI and the Redis service interaction:

Redis installation and configuration on Linux servers

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.