当前位置:网站首页>Redis_ Linux Installation
Redis_ Linux Installation
2022-07-18 12:22:00 【Cold Snowflakes】
install Redis
1. After downloading , Upload to virtual machine , And unpack it /usr/local Under the table of contents
tar -zxvf redis-5.0.14.tar.gz -C /usr/local
2. install g++ compiler
yum install gcc-c++
3. Enter into /usr/local/redis-5.0.14 Under the table of contents , Build and install
# compile
make MALLOC=libc # If it is 5 This version , The distributor needs to be specified as libc
# install
make install
After installation , To /usr/local/bin Under the table of contents
[[email protected] bin]# pwd
/usr/local/bin
[[email protected] bin]# ls
redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
Then you can run .
modify Redis The configuration file
cd /usr/local/redis-5.0.14/ # Enter the installation directory
cp redis.conf redis.conf.bak # Backup
vim redis.conf
# Modify the following places
#bind 127.0.0.1
bind 0.0.0.0
# Monitor address , Change here to at any IP All accessible
# daemonize no
daemonize yes
# It is amended as follows yes After that, it can run in the background
logfile "redis.log"
#dir ./
dir /root
# requirepass foobared
requirepass root
# Set the password to root
Then you can run with the specified configuration file , And it runs in the background 
# stop it redis
[[email protected] redis-5.0.14]# kill -9 7393
# I put redis.conf Medium dir Change it to /root Found that
Start anywhere redis
The log file will be in the current directory and /root Generate under directory
dump.rdb In the installation directory and /root Create... In the directory
Set power on self start
# Generally in /etc/systemd/system/ and /usr/lib/systemd/system/ Under the table of contents
cd /etc/systemd/system # Go to this directory
vim redis.service # Write a system service file
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /usr/local/redis-5.0.14/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
# Note the path to the executable Write absolute path
# Then when you start the virtual machine again , The system will load it , You can use systemctl To manage redis 了 .
# It can also be loaded immediately
systemctl daemon-reload # Reload the unit configuration
# It can be used later systemctl 了
systemctl status redis
systemctl start redis
systemctl enable redis
# Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service
# to /etc/systemd/system/redis.service.
# man systemd.unit
UNIT LOAD PATH ( Unit file loading path )
Unit files are loaded from a set of paths determined during compilation, described in the two tables below. Unit
files found in directories listed earlier override files with the same name in directories lower in the list.
Table 1. Load path when running in system mode (--system).
┌────────────────────────┬─────────────────────────────┐
│Path │ Description │
├────────────────────────┼─────────────────────────────┤
│/etc/systemd/system │ Local configuration │
├────────────────────────┼─────────────────────────────┤
│/run/systemd/system │ Runtime units │
├────────────────────────┼─────────────────────────────┤
│/usr/lib/systemd/system │ Units of installed packages │
└────────────────────────┴─────────────────────────────┘
Additional units might be loaded into systemd ("linked") from directories not on the unit load path.
See the link command for systemctl(1). Also, some units are dynamically created via a systemd.generator(7).
UNIT GARBAGE COLLECTION ( Garbage collection )
The system and service manager loads a unit's configuration automatically when a unit is referenced for the first time. It will automatically unload the unit configuration and state again when the unit is not needed anymore ("garbage collection"). A unit may be referenced through a number of different mechanisms: 1. Another loaded unit references it with a dependency such as After=, Wants=, ... 2. The unit is currently starting, running, reloading or stopping. 3. The unit is currently in the failed state. (But see below.) 4. A job for the unit is pending. 5. The unit is pinned by an active IPC client program. 6. The unit is a special "perpetual" unit that is always active and loaded. Examples for perpetual units are the root mount unit -.mount or the scope unit init.scope that the service manager itself lives in. 7. The unit has running processes associated with it. The garbage collection logic may be altered with the CollectMode= option, which allows configuration whether automatic unloading of units that are in failed state is permissible, see below. Note that when a unit's configuration and state is unloaded,
all execution results, such as exit codes, exit signals, resource
consumption and other statistics are lost, except for what is stored in the log subsystem.
Use systemctl daemon-reload or an equivalent command to reload unit configuration
while the unit is already loaded.
In this case all configuration settings are flushed out and replaced with the new configuration
(which however might not be in effect immediately),however all runtime state is saved/restored.
# man systemd.exec
PrivateTmp=
Takes a boolean argument. If true, sets up a new file system namespace for the executed processes and mounts
private /tmp and /var/tmp directories inside it that is not shared by processes outside of the namespace.
This is useful to secure access to temporary files of the process, but makes sharing between processes
via /tmp or /var/tmp impossible.
If this is enabled, all temporary files created by a service in these directories will be removed
after the service is stopped. Defaults to false.
It is possible to run two or more units within the same private /tmp and /var/tmp namespace
by using the JoinsNamespaceOf= directive,see systemd.unit(5) for details.
Note that using this setting will disconnect propagation of mounts from the service to the host
(propagation in the opposite direction continues to work).
This means that this setting may not be used for services which shall be able to install mount points
in the main mount namespace.
redis_linux Installation package
Linux Customize system services
Systemd_Unit In file PrivateTmp Field details
Linux in man How to use commands
man How to use commands
man manual Online
Systemd Introductory tutorial
Systemctl Create services
systemctl Add custom service
# to update man manual
yum install man-pages
# see man Manual version
man --version
# Vim Many commands in man It can also be used in the manual
( Space page down ,b Page up , Enter scroll down one line ,k Scroll up one line )
Find keyword usage and Vim The same in China
# g Move to the beginning of the document ,G Move to the end of the document
# man You can also check yourself
man man
# List all chapters socket
man -f socket
边栏推荐
- 谷歌 | 图神经网络预训练帮助了分子表征吗
- JVM introduction
- 技术分享| 快对讲-5G对讲
- 中文版《开放敏捷架构精选示例案例研究》官网正式上线,精彩先睹为快!
- 1523. Count the number of odd numbers within the interval
- En trois étapes, j'ai terminé MySQL en une journée, ce qui m'a permis d'obtenir l'offre de tmall en douceur.
- MySQL original field to hump naming
- vue+mysql连接数据库实现登录注册
- On July 16, 2022, the results of cdga/cdgp data governance certification examination came out!
- 279. Complete square
猜你喜欢

Statistics of Top100 domestic NFT Platform Alliance chain and public chain usage

Appium automation test foundation - WebView operation (key)

Terraform命令行工具介绍、安装、使用

圖片格式解析

Restrict ASML from supplying lithography machines to China? In fact, it has been inseparable from the Chinese market

Map set to object, map field has horizontal lines, object to map

数据库定时备份linux篇

Regular database backup Linux

Flink基础记录补充

JupyterLab安装
随机推荐
三個步驟,一天就搞定了MySQL,讓我順利拿下了天猫offer
0714下午1,review,
Does Google | map neural network pre training help molecular characterization
Terraform命令行工具介绍、安装、使用
The value of applet container technology in hybrid hybrid app development
1523. 在区间范围内统计奇数数目
Luogu questionnaire - greed
Openeuler knowledge: management strategy
Part 50 - Analysis of a query request header parameter [2022-07-14]
openEuler 知:常用网址
C # résoudre les json imbriqués en utilisant jobject
【Jailhouse 文章】Bao: a modern lightweight embedded hypervisor(2020)
秋招问题汇总
HDU word count
今晚8点! LightDB PG分布式数据库技术创新与实践”
Community summit pulsar summit old golden peak conference topic highlights exposure!
Simulation static method in mockito
Restrict ASML from supplying lithography machines to China? In fact, it has been inseparable from the Chinese market
JVM tuning practice (detailed version)
Logic of automatic reasoning 02 propositional calculus