Environment building under Redis Linux

Source: Internet
Author: User

System CentOS7

Redis official website Download https://redis.io/download

1. Download unzip

[[email protected] programs] # /usr/local/programs [[email protected] programs] # wget http://download.redis.io/releases/redis-4.0.1.tar.gz [[email protected] programs] # tar xzf redis-4.0.1.tar.gz [[email protected] programs] # mv redis-4.0.1  redis4    #移动到自己想放置的地方

2. Compiling the installation

[[email protected] programs] # CD  /USR/LOCAL/PROGRAMS/REDIS4

Install (using PREFIX to specify the installation directory):

# Make PREFIX=/USR/LOCAL/PROGRAMS/REDIS4 Install
After the installation is complete, you can see a bin directory under the/USR/LOCAL/PROGRAMS/REDIS4 directory, which is the Redis command script in the bin directory:

[[email protected] REDIS4] # ls00-releasenotes  BUGS          COPYING  INSTALL   MANIFESTO  redis.conf  runtest-  Cluster   sentinel.conf  testsbin              contributing  deps     Makefile  readme.md  runtest     runtest-Sentinel  src            utils[root@TestServer-dfjr redis4]#

4. Execute the redis-server command to start the Redis service

[[email protected] REDIS4] # CD Bin [[email protected] bin] # ./redis-server

Note: The Redis service, which executes the redis-server boot directly, is run directly in the foreground (as an effect), that is, if LUnix closes the current session after executing the command, the Redis service is closed. Under normal circumstances, starting the Redis service requires booting from the background and specifying a startup configuration file.

5. Background Start Redis Service

A) First edit the Conf file and change the Daemonize property to Yes (indicating that you need to run in the background)
VI redis.conf

b) Start the Redis service again and specify the startup service profile

Bin/redis-server redis.conf

6. After the server starts successfully, execute REDIS-CLI to start the Redis client and view the port number.

Redis-cli-a 123456 #连接redis数据库, note:-A followed by a Redis database password

Default is no password, direct input

Src/redis-cli

Then you can execute the redis command.

8. Stop the server

Enter shutdown in the client

Exit Client is exit

9. Uninstalling the Redis service

Delete the relevant directories and files directly

10. Setting Environment variables

To add Redis to an environment variable:
# Vi/etc/profile
At the end, add the following:
# # Redis Env
Export path= $PATH:/usr/local/program/redis/bin
To make the configuration effective:
# Source/etc/profile
Redis commands such as REDIS-CLI can now be used directly:

Environment building under Redis Linux

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.