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 build Redis Server in Linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces how to build a Redis server in Linux, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

System environment

Operating system: CentOS 6.9

Redis version: redis-4.0.2 installation step

1. Install the pre-environment

Run the following command to install the pre-environment.

[root@redis02 redis-4.0.2] # yum-y install gcc make

2. Download the redis source code file and extract it

After downloading the redis source code, run the following command to extract it.

[root@redis02 softwares] # tar-xzf redis-4.0.2.tar.gz

3Gramming redis compilation

Run the make command to compile.

After the compilation of the make command is completed, six executable files are generated in the src directory, namely redis-server, redis-cli, redis-benchmark, redis-check-aof, redis-check-dump, and redis-sentinel.

4PowerRedis installation configuration

Run the make install command.

After the command is executed, the executable file generated by make compilation is copied to the / usr/local/bin directory, as shown in the following figure.

Then, run the. / utils/install_server.sh configuration wizard to configure redis, and you can add the redis service to boot. [important]

5. View, enable and close the redis service

At this point, the redis service has started. You can manipulate redis with the following command.

View the running status of redis:

[root@redis02 redis-4.0.2] # service redis_6379 status

Shut down the redis service:

[root@redis02 redis-4.0.2] # service redis_6379 stop

Enable the redis service:

[root@redis02 redis-4.0.2] # service redis_6379 start

Finally, you can test it through redis's built-in client tools:

[root@redis02 ~] # redis-cli127.0.0.1:6379 > get name (nil) 127.0.0.1 get name 6379 > set name mcgradyOK127.0.0.1:6379 > get name "mcgrady" 127.0.0.1 get name 6379 >

As you can see, the redis service has been successfully configured!

Matters needing attention

1. Run the make command to report an error?

The error message is as follows:

Make [3]: gcc: Command not found/bin/sh: cc: command not found

Solution:

Because the preenvironment is not installed, run the following command to install the preenvironment.

[root@redis02 redis-4.0.2] # yum-y install gcc make

2. Run the make command after installing the pre-environment and report the following error?

Error message:

Zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directoryzmalloc.h:55:2: error: # error "Newer version of jemalloc required"

Solution:

Run the following command.

Make MALLOC=libc

3. Run the make test command to report the following error?

Error message:

You need tcl 8.5 or newer in order to run the Redis test

Solution:

Run the following command to install tcl.

[root@redis02 redis-4.0.2] # yum-y install tcl

4. Report an error when calling ConnectionMultiplexer.Connect to create a connection?

Error message:

It was not possible to connect to the redis server (s); to create a disconnected multiplexer, disable AbortOnConnectFail. UnableToResolvePhysicalConnection on TIME

Solution:

1) turn off protection mode and note that it is on by default.

2) bind IP. Note that only 127.0.0.1 is bound by default.

Useful commands:

Telnet 192.168.1.29 6379, you can directly test whether the client can connect to the server, if so, basically no problem.

Ps-aux | grep redis, check the process of redis to see if redis starts normally.

Thank you for reading this article carefully. I hope the article "how to build a Redis server in Linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Servers

Wechat

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

12
Report