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

Example Analysis of Redis 4.0Source Code installation

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the Redis 4.0 source code installation example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.

Go to the official website to download software

Https://redis.io/download

The latest stable version is 4.0

Upload to the server

Decompression software

[root@MySQL01 ~] # cd / install/

[root@MySQL01 install] # tar xvfz redis-4.0.2.tar.gz

Compilation and installation

[root@MySQL01 install] # cd redis-4.0.2

[root@MySQL01 redis-4.0.2] # make

...

CC module.o

CC evict.o

CC expire.o

CC geohash.o

CC geohash_helper.o

CC childinfo.o

CC defrag.o

CC siphash.o

CC rax.o

LINK redis-server

INSTALL redis-sentinel

CC redis-cli.o

LINK redis-cli

CC redis-benchmark.o

LINK redis-benchmark

INSTALL redis-check-rdb

INSTALL redis-check-aof

Hint: It's a good idea to run 'make test';)

Make [1]: Leaving directory `/ install/redis-4.0.2/src'

Start redis

[root@MySQL01 redis-4.0.2] # src/redis-server &

[1] 48741

[root@MySQL01 redis-4.0.2] # 48741:C 03 Nov 19:29:48.941 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

48741:C 03 Nov 19:29:48.941 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=48741, just started

48741:C 03 Nov 19:29:48.941 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server / path/to/redis.conf

48741 it was originally set to M 03 Nov 19V 29V 48.944 * Increased maximum number of open files to 10032 (it was originally set to 1024)

_. _

_.-``_'-. _

_.-``` `_. '' -. _ Redis 4.0.2 (00000000Universe 0) 64 bit

.-``.-```. ```\ / _, _'-. _

(',.-`|`,) Running in standalone mode

| | `-. _` -.-`_ _.-.`` -. _ |'` _. -'| Port: 6379 |

| | `-. _`. _ / _. -'| PID: 48741 |

`-. _` -. _ `. /. -'_. -'

| | `-. _ _. -'|

| | `-. _` -. _ _. -'_. -'| http://redis.io |

`-. _` -. _ `. -'_. -'

| | `-. _ _. -'|

| | `-. _` -. _. -'_. -'|

`-. _` -. _ `. -'_. -'

`-. _`. _ _. -'_. -'

`-. _. -'

`-. _. -'

48741:M 03 Nov 19:29:48.950 # WARNING: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/core/somaxconn is set to the lower value of 128.

48741:M 03 Nov 19:29:48.950 # Server initialized

48741:M 03 Nov 19:29:48.950 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory=1' to / etc/sysctl.conf and then reboot or run the command' sysctl vm.overcommit_memory=1' for this to take effect.

48741 THP M 03 Nov 1915 29 support enabled in your kernel 48.950 # WARNING you have Transparent Huge Pages (THP). This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > / sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your / etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

48741 seconds M 03 Nov 1929 seconds 48.950 * seconds

48741rig M 03 Nov 19rig 29uv 48.950 * Ready to accept connections

Connect to redis through built-in client tools

[root@MySQL01 redis-4.0.2] # src/redis-cli

127.0.0.1 purl 6379 > set foo bar

OK

127.0.0.1 purl 6379 > get foo

"bar

View the process

[root@MySQL01 redis-4.0.2] # ps-ef | grep redis

Root 48741 1 0 Nov03? 00:00:25 src/redis-server *: 6379

Install Redis client libraries for the Python 3.6.1 language

[root@MySQL01 redis-4.0.2] # pip3 install redis hiredis

Collecting redis

Downloading redis-2.10.6-py2.py3-none-any.whl (64kB)

100% | ██ | 71kB 107kB/s

Collecting hiredis

Downloading hiredis-0.2.0.tar.gz (46kB)

100% | ██ | 51kB 501kB/s

Installing collected packages: redis, hiredis

Running setup.py install for hiredis... Done

Successfully installed hiredis-0.2.0 redis-2.10.6

Log in to Redis through Python 3

[root@MySQL01 redis-4.0.2] # python

Python 3.6.1 (default, Oct 2 2017, 06:28:48)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux

Type "help", "copyright", "credits" or "license" for more information.

> import redis

> > conn = redis.Redis ()

> conn.set ('hello',' world')

True

> conn.get ('hello')

Baked world'

Thank you for reading this article carefully. I hope the article "sample Analysis of Redis 4.0 Source installation" 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: 263

*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

Database

Wechat

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

12
Report