Steps and solutions for installing Redis in Linux

Source: Internet
Author: User

Steps and solutions for installing Redis in Linux

This document details the steps for installing Redis in Linux and the solutions to related problems.

Step 1: Decompress the installation package on the Windows platform and copy the package to the/usr/soft directory of the Linux machine. Also, grant the maximum permission to the folder and file, chmod + x *;

Step 2: Go to the redis-3.2.6 directory and execute the make command. A file cannot be found.

In this case, run the following command: make MALLOC = libc

In this case, the operation is successful.

Step 3: Execute make install.

In the/usr/local/bin directory, the following files are displayed:

Step 4: run the command. View version information: redis-serer-v

Now, the redis installation is complete, and the configuration information is complete.

Step 5: Configure:

5.1 create a directory:

Create the redis directory in the/etc and/var directories respectively.

First, go to the/etc directory:

Cd/etc

Mkdir redis

Then go to the var directory:

Cd/var

Mkdir redis

Cd redis

Mkdir data log run

 

5.2 configure the conf file

First copy the redis. conf file in the/usr/soft/redis-3.2.6 directory to the/etc/redis directory.

Scp/usr/soft/redis-3.2.6/redis. conf/etc/redis

Open redis. conf in the/etc/redis directory. Then modify some information:

Modify Port:

Change the pid directory to a new directory.

Change the dump directory to a new directory.

Change the log storage directory to a new directory.

5.3 persistence

Default rdb. You can choose whether to enable aof. If yes, modify the configuration file appendonly.

5.4 start redis and view files in various directories.

Enter the command in the/etc/redis Directory: redis-server/etc/redis. conf

At this time, the cursor is flashing, indicating that the process is being executed. Press Ctrl + C to exit the process.

The following logs are printed: tail-f/var/redis. log

 

View the process ps-ef | grep redis. If the following figure is displayed, redis is successfully started.

View the logs generated by redis.

We can see that redis is generating the corresponding data.

The dump file is empty.

Only logs are found, with no dump or pid information, because the redis service is still running in console mode and there is no data storage operation.

Stop the redis service and modify the configuration file so that redis runs on the background

Changed to yes, indicating that the instance is started as a daemon. Save and restart the redis service. In this case, the cursor does not flash, but runs in the background. Run [root @ localhost bin] #

View dump and pid information as follows. If the aof persistence mode is configured, aof files will be stored in the data directory.

Step 6: connect the client to the Redis server.

Default port: 6379.

Step 7: START automatically.

Copy the startup script file in the redis unzipping package to the/etc/init. d directory:

Scp/usr/soft/redis-3.2.6/utils/redis_init_script/etc/init. d/

Change the Script Name (or not) to redis.

 

Change the script pid and conf path to the actual path.

 

Save and exit. In the/etc/init. d/directory, you can use the service redis start/stop command to start and close redis.

If the permission is insufficient, modify the permission: chmod + x/etc/init. d/redis

At this time, service redis stop will be successful.

Restart: service redis start

 

Set auto-start:

Set auto-start

Chkconfig redis on, the following error will be reported: (because the redis startup priority information is not added to the startup script)

Redis does not support chkconfig.

Solution: Add # chkconfig: 2345 90 10 to the first line of the/etc/init. d/redis STARTUP script file and exit. Then chkconfig redis on is successful.

This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151172.htm

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.