当前位置:   article > 正文

centos8.5 安装 redis 7.2.4 详细步骤_redis7.2.4安装使用

redis7.2.4安装使用

1 下载Index of /releases/ (redis.io)

通过xftp等方式上传到服务器,安装依赖包

yum install gcc gcc-c++ make  tcl -y
  1. [root@localhost software]# ll
  2. total 3308
  3. -rw-r--r--. 1 root root 3386861 May 3 21:56 redis-7.2.4.tar.gz
  4. [root@localhost software]# ll
  5. total 3308
  6. -rw-r--r--. 1 root root 3386861 May 3 21:56 redis-7.2.4.tar.gz
  7. [root@localhost software]# tar xf redis-7.2.4.tar.gz
  8. [root@localhost software]# mv redis-7.2.4/ redis/
  9. [root@localhost software]# cd redis/
  10. [root@localhost redis]# make MALLOC=libc
  11. [root@localhost redis]# make test
  12. \o/ All tests passed without errors!
  13. Cleanup: may take some time... OK
  14. make[1]: Leaving directory '/data/software/redis/src'
  15. [root@localhost redis]# make install PREFIX=/usr/local/redis
  16. cd src && make install
  17. make[1]: Entering directory '/data/software/redis/src'
  18. Hint: It's a good idea to run 'make test' ;)
  19. INSTALL redis-server
  20. INSTALL redis-benchmark
  21. INSTALL redis-cli
  22. make[1]: Leaving directory '/data/software/redis/src'
  23. [root@localhost redis]# mkdir -p /usr/local/redis/etc
  24. [root@localhost redis]# cp redis.conf /usr/local/redis/etc/
  25. [root@localhost redis]# vim /usr/local/redis/etc/redis.conf
  26. bind 127.0.0.1 -::1-->bind 0.0.0.0
  27. # requirepass foobared-->requirepass 123456
  28. daemonize no-->daemonize yes
  29. #vim /etc/profile
  30. export PATH="$PATH:/usr/local/redis/bin"
  31. #source /etc/profile
  32. #过量使用内存设置为0!在低内存环境下,后台保存可能失败
  33. [root@localhost redis]# vim /etc/sysctl.conf
  34. vm.overcommit_memory = 1
  35. [root@localhost redis]# sysctl -p

 2 启动

  1. [root@localhost redis]# redis-cli -v
  2. redis-cli 7.2.4
  3. [root@localhost redis]# redis-server /usr/local/redis/etc/redis.conf

#查看进程 

#测试下

#配置系统服务启动

  1. [root@localhost redis]# vim /etc/systemd/system/redis.service
  2. [Unit]
  3. Description=redis-server
  4. After=network.target
  5. [Service]
  6. Type=forking
  7. ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
  8. PrivateTmp=true
  9. [Install]
  10. WantedBy=multi-user.target
  11. 重新加载系统服务
  12. systemctl daemon-reload
  13. 设置开机自启:
  14. systemctl enable redis
  15. #关闭之前启动的进程
  16. ps -ef | grep redis| grep -v grep| awk -F " " '{print $2}'| xargs kill -9
  17. 启动服务
  18. systemctl start redis

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/699046
推荐阅读
相关标签
  

闽ICP备14008679号