Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install redis on Linux system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Linux system how to install redis, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Redis is an open source remote dictionary service written in ANSI c and provides API in multiple languages.

Download the Redis installation package

Go to redis official website to download reids installation package, redis official website only provides Linux installation package by default, so do not worry about downloading to windows installation package. I downloaded redis-3.2.1.tar.gz. Download for the redis source code, should use the source code installation method to install redis.

Second, install redis

\ 1. Decompress: tar-zxvf redis-3.2.1.tar.gz

\ 2. Enter the extracted directory and perform the compilation operation: make test

\ 3. At the end of the compilation test, the following message proves that there is no problem: the compiled command is placed in the src directory

\ 4. After the compilation is successful, perform the install operation: sudo make install

\ 5. At present, redis has been successfully installed. The commands related to redis are stored in the.. / redis-3.2.1/src directory, and the following files are generated in the / usr/local/bin/ directory:

2. Uninstall redis

\ 1. Check to see if reids is running, and if so, close it first

As can be seen from the figure, redis-server is currently running on port 6379.

\ 2. If the redis-server service is running in the background, you need to stop the redis-server service:

Stop the redis-server service normally, using the reids client command: redis-cli shutdown

If it cannot be stopped, the process is killed: kill-9 PID

\ 3. Delete the commands related to redis in the / usr/local/lib directory:

\ 4. Delete the directory redis-3.2.1 after redis is decompressed

Start-up of three redis

After the redis installation is successful, it will generate the corresponding reids command file, all the commands are in the src directory, and several commands of reids-* will be generated under the / usr/local/bin directory, so that we can call the relevant commands of redis without using the absolute path. there are many ways to start reids, background startup, script startup and so on.

\ 1. Redis background startup: redis-server &

No configuration file is specified in this way, the default configuration is used and a Warning: no config file is printed. .

Press ctrl + C to exit the redis startup window. At this time, redis will not be closed, but will run in the background. You can view it with the command: ps aux | grep redis

\ 2. Specify configuration file startup: redis-server * / redis.conf

After decompressing the original redis, there is a redis configuration template redis.conf in the directory. We can make a copy and modify it into our own redis configuration file. Here the author only modifies one port number, changes the port number to 8080, and then uses this configuration file to start the redis service

Turn off the use command: redis-cli-p 8080 shutdown

\ 3. Set up boot boot:

Four redis customer segment connections:

After redis is installed successfully, a redis-cli client is generated, which can connect to a local or remote redis server through the redis-cli command. The redis-cli command has many parameters. The common options are-h-p-u-a, corresponding to ip address, port number, user name and password. You can view the common options of redis-cli through redis-cli-help.

\ 1. Example of connecting to a local redis:

\ 2. Connect to the remote redis:

5. Turn off redis

\ 1. Close local redis: redis-cli shutdown normally, and disable local 6379 redis by default

If you can't shut it down normally, you can shut it down by killing the thread:

\ 2. Shut down the redis server remotely: redis-cli-h xxx.xxx.xxx.xxx-p xxxx-u xxxx-a xxxx shutdown

Redis and Memcached are somewhat similar to a key-value storage system that supports relatively more value types of storage.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report