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

Redis-4.0.1 installation configuration (CentOS 6.6)

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

I. Redis service installation configuration 1. Download the decompression redis package

# wget http://download.redis.io/releases/redis-4.0.1.tar.gz

# tar zxvf redis-4.0.1.tar.gz

# cd redis-4.0.1

two。 Compile and install redis

# make MALLOC=jemalloc

# make PREFIX=/application/redis-4.0.1 install

# ln-s / application/redis-4.0.1/ / application/redis

# tree / application/redis/bin/

/ application/redis/bin/

|-- redis-benchmark # Redis performance testing tool to test the read and write performance of redis on your system and your configuration

|-- redis-check-aof # Update log check

|-- redis-check-rdb

|-- redis-cli # Redis command line operation tool. You can also use telnet to operate according to the plain text protocol.

|-- redis-sentinel-> redis-server |

`- redis-server # daemon launcher of Redis server

3. Configure environment variables

# echo "export PATH=/application/redis/bin:$PATH" > > / etc/profile

# source / etc/profile

# redis-server-help

# mkdir / application/redis/conf

[root@wangning redis-4.0.1] # cp redis.conf / application/redis/conf/

4. Start and shut down the redis service

# redis-server / application/redis/conf/redis.conf & # start the redis service

[1] 10047

[root@wangning redis-4.0.1] # 10047:C 26 Jul 15:19:17.150 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

10047:C 26 Jul 15:19:17.150 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=10047, just started

10047:C 26 Jul 15:19:17.150 # Configuration loaded

10047 Jul 26 Jul 15 it was originally set to 1917. 152 * Increased maximum number of open files to 10032.

_. _

_.-``_'-. _

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

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

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

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

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

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

| | `-. _ _. -'|

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

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

| | `-. _ _. -'|

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

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

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

`-. _. -'

`-. _. -'

10047:M 26 Jul 15:19:17.162 # WARNING: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/core/somaxconn is set to the lower value of 128.

10047:M 26 Jul 15:19:17.162 # Server initialized

10047:M 26 Jul 15:19:17.162 # 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.

10047 Jul 26 Jul 15 THP 1914 17 163 WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. 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.

10047 Jul M 26 15 Jul 1914 17 163 * Ready to accept connections

# ps-ef | grep redis

Root 11627 6315 0 15:40 pts/1 00:00:00 redis-server 127.0.0.1:6379

# kill 11627

# echo 1024 > / proc/sys/net/core/somaxconn # set the value to be greater than 511

# sysctl vm.overcommit_memory=1 # temporary effect

# echo never > / sys/kernel/mm/transparent_hugepage/enabled # temporarily effective

# redis-server / application/redis/conf/redis.conf &

# lsof-iRU 6379

# redis-cli shutdown # disable the redis service

5. Connection redis service test

Interactive usage

[root@wangning redis-4.0.1] # redis-cli

127.0.0.1purl 6379 >

127.0.0.1 purl 6379 > help get

GET key

Summary: Get the value of a key

Since: 1.0.0

Group: string

127.0.0.1 purl 6379 > help set

SET key value [EX seconds] [PX milliseconds] [NX | XX]

Summary: Set the string value of a key

Since: 1.0.0

Group: string

127.0.0.1 purl 6379 > set no002 wangning

OK

127.0.0.1 purl 6379 > get no002

"wangning"

127.0.0.1 purl 6379 > quit

Or

[root@wangning redis-4.0.1] # telnet 127.0.0.1 6379

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is'^]'.

Set no002 wangning

+ OK

Get no002

$8

Wangning

Quit

+ OK

Connection closed by foreign host.

Non-interactive usage

# redis-cli-h 127.0.0.1-p 6379 set no002 wangning

# redis-cli-h 127.0.0.1-p 6379 get no002

"wangning"

Or

# redis-cli set no002 wangning

# redis-cli get no002

"wangning"

# redis-cli-h 10.0.0.21-p 6379 info # Statistics

II. Install the redis client extension for PHP

# wget https://github.com/nicolasff/phpredis/archive/master.zip

# unzip master.zip

# cd phpredis-master/

# / application/php/bin/phpize

#. / configure-with-php-config=/application/php/bin/php-config

# make

# make install

# echo "extension = redis.so" > > / application/php/lib/php.ini

# killall php-fpm

# / application/php/sbin/php-fpm

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

Database

Wechat

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

12
Report