当前位置:网站首页>Centos7 installation and configuration of redis database
Centos7 installation and configuration of redis database
2022-07-02 21:35:00 【yaoyaozaiye】
CentOS7 Installation configuration Redis database
【 Operation steps 】
1. download redis Installation package wget http://download.redis.io/releases/redis-5.0.3.tar.gz
2. Unzip the installation package tar -zxvf redis-5.0.3.tar.gz
3. install gcc Environmental Science yum install gcc
redis You need to install first gcc(C Language compiler ), because redis Yes, it is c++ Compiling .
4. compile rediscd redis-5.0.3
make
5. install redis, Also specify the directory make install PREFIX=/usr/local/redis
6. The front desk starts rediscd /usr/local/redis/bin/
./redis-server
7. Background start redis
① from redis Copy in the unzipped directory of redis.conf File to redis Of the installation directory bin Under the folder :cp /root/redis-5.0.3/redis.conf /usr/local/redis/bin/
② modify redis.conf The contents of the document vi /usr/local/redis/bin/redis.conf
- In the file daemonize Attribute to yes( Indicates the need to run in the background ), Comment out
bind 127.0.0.1
, there bind It means that only the specified network segment can remotely access this redis, When the notes are off , There is no such limitation . #requirepass foobared
Here, it is adjusted according to the configuration of the project , My current project configuration redis The password is 123456, So I changed it here torequirepass 123456
.
③ Start after modification redis ./redis-server redis.conf
8. Set the boot to start redis
① edit redis.service file vi /etc/systemd/system/redis.service
Copy the following code in , Be careful ExecStart The value of is the previous installation path .
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
② Set up self start systemctl daemon-reload
systemctl start redis.service
systemctl enable redis.service
And then in /usr/bin/redis Set one under the directory redis-cli Soft link of file ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis
Common commands - Service operation command
# start-up redis service
systemctl start redis.service
# stop it redis service
systemctl stop redis.service
# Restart the service
systemctl restart redis.service
# View the current status of the service
systemctl status redis.service
# Set power on self start
systemctl enable redis.service
# Stop power on and start up
systemctl disable redis.service
边栏推荐
- rwctf2022_ QLaaS
- Accounting regulations and professional ethics [16]
- Common authority query instructions in Oracle
- Sword finger offer (I) -- handwriting singleton mode
- [question brushing diary] classic questions of dynamic planning
- [fluent] dart technique (independent main function entry | nullable type determination | default value setting)
- China's noise meter market trend report, technical dynamic innovation and market forecast
- beginning
- Who do you want to open a stock account? Is it safe to open a mobile account?
- I drew a Gu ailing with characters!
猜你喜欢
[error record] the command line creates an error pub get failed (server unavailable) -- attempting retry 1 in 1 second
Basic knowledge of tree and binary tree (detailed illustration)
How does esrally perform simple custom performance tests?
Hot backup routing protocol (HSRP)
Three chess games
7. Build native development environment
如何防止你的 jar 被反编译?
qwb2018_ core kernel_ rop
[shutter] statefulwidget component (floatingactionbutton component | refreshindicator component)
MySQL learning record (2)
随机推荐
Structured text language XML
beginning
Volvo's first MPV is exposed! Comfortable and safe, equipped with 2.0T plug-in mixing system, it is worth first-class
Research Report on the overall scale, major manufacturers, major regions, products and applications of friction dampers in the global market in 2022
treevalue——Master Nested Data Like Tensor
Research Report on ranking analysis and investment strategic planning of RFID market competitiveness of China's industrial manufacturing 2022-2028 Edition
股票开户要找谁?手机开户是安全么?
Redis分布式锁故障,我忍不住想爆粗...
Report on investment development and strategic recommendations of China's vibration isolator market, 2022-2027
Cardinality sorting (detailed illustration)
China plastic box market trend report, technological innovation and market forecast
Write the content into the picture with type or echo and view it with WinHex
~91 rotation
Welfare, let me introduce you to someone
基本IO接口技术——微机第七章笔记
7. Build native development environment
Analysis of enterprise financial statements [1]
Baidu sued a company called "Ciba screen"
Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of signal distributors in the global market in 2022
China's noise meter market trend report, technical dynamic innovation and market forecast