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

Installation and configuration of Redis

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. Installation

$wget http://download.redis.io/redis-stable.tar.gz

Tar xzf redis-stable.tar.gz

Cd redis-stable

Make

Make install

Make test

two。 Start 2-1 start directly

Redis-server

Redis-server-port xxxx

2-2 initialization script starts

Initialization script:

Redis-stable/utils/redis_init_script

Profile template:

Redis-stable/redis.conf

(1) configure initialization script:

Copy the initialization script (redis_init_script) into the / etc/init.d directory with the file name redis_xxxx (xxxx= port number), where the port number represents the port number that you want Redis to listen on, and the client connects to Redis through that port number. Then change the REDISPORT variable value in the script to the same port number.

(2) set up the required folder

Directory name description / etc/redis to store Redis configuration file / var/redis/ port number to store Redis persistence file

(3) modify the configuration file

Copy the profile template (redis.conf) to the etc/redis directory, name it with the port number (xxxx.conf), and edit some of the parameters.

The parameter value indicates that daemonizeyes causes Redis to run in daemon mode pidfile/var/run/redis port number setting Redis PID file location port port number setting Redis listening port number dir/var/redis/ port number setting persistent file location

Start Redis:

$/ etc/init.d/redis_ port number start

Make Redis start automatically with the system:

$sudo update-rc.d redis_ port number defaults

3. Stop Redis

$redis-cli SHUTDOWN (or PID of the kill Redis process)

4. Two ways to send a command 4.1 execute the command as a parameter to redis-cli

For example:

Redis-cli SHUTDOWN

Redis-cli

Redis-cli-h 127.0.0.1-p 6379

Redis-cli PING

4.1 run redis-cli with no parameters

$redis-cli

Redis 127.0.0.1 6379 > PING

PONG

Redis 127.0.0.1 6379 > ECHO hi

"hi"

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