最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

redis7.4.2單機(jī)配置過程

 更新時(shí)間:2026年05月25日 09:25:14   作者:PABL01  
這段文章詳細(xì)介紹了通過源碼編譯安裝Redis的過程,涵蓋了從下載源碼包到卸載Redis的每一步驟,并強(qiáng)調(diào)了實(shí)踐中的實(shí)用性和重要性性,關(guān)鍵詞包括:源碼編譯、Redis安裝和卸載流程

解壓源碼包

將從官網(wǎng)下載的redis源碼壓縮包上傳到服務(wù)器的相關(guān)目錄下。

[root@hcss-ecs-2851 ~]# wget https://download.redis.io/redis-stable.tar.gz
[root@hcss-ecs-2851 ~]# mv redis-stable.tar.gz /opt/soft/redis/
[root@hcss-ecs-2851 ~]# cd /opt/soft/redis/
[root@hcss-ecs-2851 redis]# ls
redis-stable.tar.gz

解壓并進(jìn)入解壓后的目錄中。

[root@hcss-ecs-2851 redis]# tar -zxvf redis-stable.tar.gz
[root@hcss-ecs-2851 redis]# ls
redis-stable  redis-stable.tar.gz
[root@hcss-ecs-2851 redis]# cd redis-stable
[root@hcss-ecs-2851 redis-stable]# ls
00-RELEASENOTES  CODE_OF_CONDUCT.md  deps     LICENSE.txt  MANIFESTO  redis.conf              runtest          runtest-moduleapi  SECURITY.md    src    TLS.md
BUGS             CONTRIBUTING.md     INSTALL  Makefile     README.md  REDISCONTRIBUTIONS.txt  runtest-cluster  runtest-sentinel   sentinel.conf  tests  utils

安裝gcc

[root@hcss-ecs-2851 redis-stable]# yum install -y gcc gcc-c++

安裝redis

[root@hcss-ecs-2851 redis-stable]# make
root@hcss-ecs-2851 redis-stable]# make install

簡單測試是否安裝成功

[root@hcss-ecs-2851 redis-stable]# cd 
[root@hcss-ecs-2851 ~]# redis-server
9193:C 24 Mar 2025 12:03:19.847 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
9193:C 24 Mar 2025 12:03:19.847 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9193:C 24 Mar 2025 12:03:19.847 * Redis version=7.4.2, bits=64, commit=00000000, modified=0, pid=9193, just started
9193:C 24 Mar 2025 12:03:19.847 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
9193:M 24 Mar 2025 12:03:19.847 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis Community Edition      
  .-`` .-```.  ```\/    _.,_ ''-._     7.4.2 (00000000/0) 64 bit
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 9193
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

9193:M 24 Mar 2025 12:03:19.848 * Server initialized
9193:M 24 Mar 2025 12:03:19.848 * Ready to accept connections tcp

自定義設(shè)置

自定義目錄

[root@hcss-ecs-2851 ~]# cd /opt/soft/redis/
[root@hcss-ecs-2851 redis]# mkdir {etc,lib,log}
[root@hcss-ecs-2851 redis]# ls
etc  lib  log  redis-stable  redis-stable.tar.gz
[root@hcss-ecs-2851 redis]# cp redis-stable/redis.conf etc/
[root@hcss-ecs-2851 redis]# ls etc/
redis.conf

編輯redis.conf

bind 0.0.0.0 # 任意ip均可訪問
protected-mode no
port 6379
daemonize yes # 后臺運(yùn)行
pidfile /var/run/redis.pid # 運(yùn)行時(shí)進(jìn)程id
logfile /opt/soft/redis/log/redis.log #日志文件
dir /opt/soft/redis/lib/
requirepass ********* # 設(shè)置密碼

創(chuàng)建 systemd 服務(wù)文件

[root@hcss-ecs-2851 etc]# cd /etc/systemd/system/
[root@hcss-ecs-2851 system]# vim redis.service
[Unit]
Description=Redis In-Memory Data Store
After=network.target

[Service]
Type=forking
User=root
Group=root
ExecStart=/usr/local/bin/redis-server /opt/soft/redis/etc/redis.conf
ExecStop=/usr/local/bin/redis-cli -p 6379 shutdown
PIDFile=/var/run/redis.pid
Restart=on-failure

[Install]
WantedBy=multi-user.target
[root@hcss-ecs-2851 ~]# systemctl daemon-reload
[root@hcss-ecs-2851 ~]# systemctl start redis
[root@hcss-ecs-2851 ~]# systemctl status redis
● redis.service - Redis In-Memory Data Store
   Loaded: loaded (/etc/systemd/system/redis.service; disabled; vendor preset: disabled)
   Active: active (running) since 一 2025-03-24 12:43:28 CST; 8s ago
  Process: 3340 ExecStart=/usr/local/bin/redis-server /opt/soft/redis/etc/redis.conf (code=exited, status=0/SUCCESS)
 Main PID: 3341 (redis-server)
   CGroup: /system.slice/redis.service
           └─3341 /usr/local/bin/redis-server 0.0.0.0:6379

3月 24 12:43:28 hcss-ecs-2851 systemd[1]: Starting Redis In-Memory Data Store...
3月 24 12:43:28 hcss-ecs-2851 systemd[1]: Can't open PID file /var/run/redis.pid (yet?) after start: No such file or directory
3月 24 12:43:28 hcss-ecs-2851 systemd[1]: Started Redis In-Memory Data Store.
[root@hcss-ecs-2851 ~]# cd /opt/soft/redis/log/
[root@hcss-ecs-2851 log]# cat redis.log 
......
3341:M 24 Mar 2025 12:43:28.337 * Ready to accept connections tcp
[root@hcss-ecs-2851 log]# systemctl stop redis
[root@hcss-ecs-2851 log]# cat redis.log 
......
3341:M 24 Mar 2025 12:44:10.592 # Redis is now ready to exit, bye bye...

卸載redis

如果按照上述方法,即源碼編譯安裝,則基本可以按照如下流程卸載redis。
進(jìn)入源碼包目錄。

cd /opt/soft/redis/redis-stable/
make uninstall && make clean

刪除redis相關(guān)文件和目錄。

cd /opt/soft/ && rm -rf redis/
yum remove redis
rm /etc/systemd/system/redis.service 

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Redis的數(shù)據(jù)過期策略和數(shù)據(jù)淘汰策略

    Redis的數(shù)據(jù)過期策略和數(shù)據(jù)淘汰策略

    本文主要介紹了Redis的數(shù)據(jù)過期策略和數(shù)據(jù)淘汰策略,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-02-02
  • Redis客戶端連接機(jī)制的實(shí)現(xiàn)方案

    Redis客戶端連接機(jī)制的實(shí)現(xiàn)方案

    本文主要介紹了Redis客戶端連接機(jī)制的實(shí)現(xiàn)方案,包括事件驅(qū)動(dòng)模型、非阻塞I/O處理、連接池應(yīng)用及配置優(yōu)化,具有一定的參考價(jià)值,感興趣的可以了解一下
    2025-07-07
  • Redis解決Session共享問題的方法詳解

    Redis解決Session共享問題的方法詳解

    這篇文章主要為大家詳細(xì)介紹了分布式系統(tǒng)Redis解決Session共享問題的方法,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2022-07-07
  • 如何自定義redis工具jar包供其他SpringBoot項(xiàng)目直接使用

    如何自定義redis工具jar包供其他SpringBoot項(xiàng)目直接使用

    這篇文章主要介紹了如何自定義redis工具jar包供其他SpringBoot項(xiàng)目直接使用,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-03-03
  • Redis中Bitmap的使用示例

    Redis中Bitmap的使用示例

    本文主要介紹了Redis中Bitmap的使用示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-05-05
  • 超強(qiáng)、超詳細(xì)Redis數(shù)據(jù)庫入門教程

    超強(qiáng)、超詳細(xì)Redis數(shù)據(jù)庫入門教程

    這篇文章主要介紹了超強(qiáng)、超詳細(xì)Redis入門教程,本文詳細(xì)介紹了Redis數(shù)據(jù)庫各個(gè)方面的知識,需要的朋友可以參考下
    2014-10-10
  • 關(guān)于redis Key淘汰策略的實(shí)現(xiàn)方法

    關(guān)于redis Key淘汰策略的實(shí)現(xiàn)方法

    下面小編就為大家?guī)硪黄P(guān)于redis Key淘汰策略的實(shí)現(xiàn)方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-03-03
  • 基于Redis的限流器的實(shí)現(xiàn)(示例講解)

    基于Redis的限流器的實(shí)現(xiàn)(示例講解)

    下面小編就為大家分享一篇基于Redis的限流器的實(shí)現(xiàn)(示例講解),具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2017-12-12
  • 聊聊使用RedisTemplat實(shí)現(xiàn)簡單的分布式鎖的問題

    聊聊使用RedisTemplat實(shí)現(xiàn)簡單的分布式鎖的問題

    這篇文章主要介紹了使用RedisTemplat實(shí)現(xiàn)簡單的分布式鎖問題,文中給大家介紹在SpringBootTest中編寫測試模塊的詳細(xì)代碼,需要的朋友可以參考下
    2021-11-11
  • Redis Cluster模式配置

    Redis Cluster模式配置

    這篇文章主要介紹了Redis Cluster模式配置,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2025-06-06

最新評論

繁峙县| 手游| 平昌县| 伊金霍洛旗| 娱乐| 房山区| 康定县| 晴隆县| 普安县| 全州县| 横峰县| 鄄城县| 嘉义县| 新河县| 海安县| 抚宁县| 宕昌县| 云南省| 鱼台县| 台北县| 翁源县| 股票| 安丘市| 庆云县| 射洪县| 澜沧| 南靖县| 巴南区| 肃宁县| 射洪县| 工布江达县| 改则县| 饶阳县| 延寿县| 洞口县| 潞西市| 乌兰察布市| 灵璧县| 咸丰县| 陈巴尔虎旗| 星子县|