CentOS: Install redis and centosredis in a compressed package

Source: Internet
Author: User

CentOS: Install redis and centosredis in a compressed package
Install the C language environment

Redis isC language development and installationRedis needs to compile the source code downloaded from the official website and compile the dependency.Gcc environment. If noInstall the gcc EnvironmentRun the following command to install gcc:

yum install gcc-c++
Install redis

DownloadDownload the latest apsaradb for redis package to your local device.

wget https://download.redis.io/releases/redis-4.0.8.tar.gz

Decompress the downloaded package

tar zxvf redis-4.0.8.tar.gz

Go to the decompressed folder

cd redis-4.0.8

Execute the compilation command

make

After compilation, start InstallationFor redis, We need to specify an installation directory. My installation directory is:/Usr/soft/redis. You can specify the installation directory as needed.

make PREFIX=/usr/soft/redis install

The installation is complete ,:

Now, go to the installation directory and find that there is only oneBin directory,

Now, go to the decompressed directory of the original compressed package and findRedis. conf file

SetCopy the redis. conf file to the installation directory. The Copy command is as follows:

// Copy the redis. conf file to the/usr/soft/redis directory cp redis. conf/usr/soft/redis

Now go to the installation directory and view the Directory

We can see that there is only oneBin directory, now there is anotherRedis. conf configuration file.

Now we useEnable vimModify redis. confStart redis in the background

daemonize no

Change

daemonize yes

After modification,

UseIn the bin directoryRedis-server File startupRedis, and loadRedis. conf configuration file. The command is as follows:

./bin/redis-server redis.conf

Started successfully,

CheckRedis Port

ps -ef | grep -i redis

We can see thatRedis is up. The port number is6379. The process is24543

Stop redis Service

RunRedis installation directoryIn the bin directoryRedis-cli command, stopRedis Service

./bin/redis-cli shutdown

After stopping, let's checkRedis process information. The command is as follows:

ps -ef | grep -i redis

Effect

We can see that noThe redis-server process provesThe redis service has stopped.

Connect to the redis Database

RunRun the following command to connect to the database through redis-cli:

./bin/redis-cli

Effect:

Here we have successfully connectedRedis database.

After the connection is completed, we need to disconnect the client because there are a limited number of connected clients. The following command is used to disconnect the client:

exit

Effect

Here we have successfully connected the Port Database.

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.