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 installation configuration 3.2.9

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Installation

Download, extract, compile:

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

# tar xzf redis-3.2.9.tar.gz

# cd redis-3.2.9

# make

After the binary file is compiled, in the src directory, start the Redis service with the following command:

# src/redis-server

You can use the built-in client command redis-cli to use:

# src/redis-cli

127.0.0.1 purl 6379 > set foo bar

OK

127.0.0.1 purl 6379 > get foo

"bar"

# default port 6379 for redis:

[root@Darren1 redis-3.2.9] # ps-ef | grep redis

Root 67516 63422 0 03:15 pts/5 00:00:00 src/redis-server *: 6379

Root 67520 63443 0 03:15 pts/6 00:00:00 grep redis

[root@Darren1 redis-3.2.9] # ss-nltup | grep redis

Tcp LISTEN 0128 *: 6379 *: * users: ("redis-server", 67516pr. 5)

Tcp LISTEN 0 128: 6379: * users: ("redis-server", 67516pr. 4)

Configuration

View configuration

The configuration file for Redis is located in the Redis installation directory and the file name is redis.conf.

You can view or set configuration items through the CONFIG command.

[root@Darren1 src] # find /-name redis.conf

/ home/redis/redis-3.2.9/redis.conf

[root@Darren1 src] #. / redis-cli

127.0.0.1 purl 6379 > config get config_setting_name

(empty list or set)

127.0.0.1 purl 6379 > config get loglevel

1) "loglevel"-- string name

2) "notice"-configuration value

# use * to get all configurations

127.0.0.1 6379 > config get *

Edit configuration

You can modify the configuration by modifying the redis.conf file or by using the CONFIG set command.

Grammar

The basic syntax of the CONFIG SET command:

CONFIG SET CONFIG_SETTING_NAME NEW_CONFIG_VALUE

Example:

127.0.1 6379 > config set loglevel "notice"

OK

127.0.0.1 purl 6379 > config get loglevel

1) "loglevel"

2) "notice"

127.0.0.1purl 6379 >

Create soft links and add environment variables

[root@Darren1 local] # ln-s / home/redis/redis-3.2.9 / usr/local/redis

Echo 'export PATH=$PATH:/usr/local/redis/src' > > / etc/profile

Source / etc/profile

Redis startup and shutdown

First, you need to modify the configuration file:

Daemonize yes

# means to enable the daemon so that it starts automatically in the background when starting with redis-server.

Pidfile / data/redis/redis_6379.pid

# starting the daemon generates a pid file

Logfile "/ data/redis/redis.log"

# redis log location

Start redis: you must specify a redis.conf file

[root@Darren1 redis] # redis-server / usr/local/redis/redis.conf

Turn off redis:

[root@Darren1 redis] # redis-cli shutdown

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