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

CentOS 7 installation configuration Redis database

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

Share

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

Redis is a kind of non-relational database based on key-value. Here I will show you how to install and configure Redis under CentOS 7.

Redis source code acquisition

Go to the Redis official website to get the download address of the latest stable version of Redis.

Http://redis.io/

Download the Redis source code through the wget command.

Wget http://download.redis.io/releases/redis-3.2.1.tar.gz

Make

Zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory

If you have the above errors, please use make MALLOC=libc.

Make install copies the executable files generated by make compilation to the / usr/local/bin directory

After executing. / utils/install_server.sh configuration Redis configuration, Redis can start with the system.

Redis service viewing, enabling, shutting down

1. View the Redis process through the ps-ef | grep redis command

2. Enable Redis service via / etc/init.d/redis_6379 start command or (service redis_6379 start)

3. Disable the Redis service through the / etc/init.d/redis_6379 stop command or (service redis_6379 stop)

Use the Redis startup script to set up the boot self-startup script

It is recommended that you use startup scripts to start redis services in a production environment. The startup script redis_init_script is located in the / utils/ directory of Redis.

# A general glance at the startup script shows that redis habitually uses the port name of the listener as the name of the configuration file, and we follow this convention later. # the location of the REDISPORT=6379# server on which the redis server listens is stored as `/ usr/local/bin/redis- server` by default after make install. If there is no make install, the path needs to be modified, as shown below. EXEC=/usr/local/bin/redis-server# client location CLIEXEC=/usr/local/bin/redis-cli#Redis PID file location PIDFILE=/var/run/redis_$ {REDISPORT} .pid # configuration file location, CONF= "/ etc/redis/$ {REDISPORT} .conf" configuration environment needs to be modified

1. According to the requirements of the startup script, copy a copy of the modified configuration file to the specified directory under the name of the port. A root user is required.

Mkdir / etc/rediscp redis.conf / etc/redis/6379.conf

two。 Copy the startup script to the / etc/init.d directory. In this example, the startup script is named redisd (usually ending in d to indicate a background self-starting service).

Cp redis_init_script / etc/init.d/redisd

3. Set to boot self-boot

Direct configuration here to enable self-booting chkconfig redisd on will report an error: service redisd does not support chkconfig

The following two lines of comments must be placed in the top comment of the / etc/init.d/redis file:

Add the following two lines of comments at the beginning of the startup script to modify its run level:

#! / bin/sh# chkconfig: 2345 901 description: Redis is a persistent key-value database## is set to boot the server chkconfig redisd on# to open the service service redisd start# and close the service service redisd stop

Record background operation

Nohup / usr/local/src/redis-3.2.1/src/redis-server / usr/local/src/redis-3.2.1/redis.conf &

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