CentOS7下安装Redis服务

冷不防 2022-05-21 08:19 514阅读 0赞

1、查看Redis安装源

  1. yum search redis
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. ==================================================================================== N/S matched: redis =====================================================================================
  5. collectd-redis.x86_64 : Redis plugin for collectd
  6. collectd-write_redis.x86_64 : Redis output plugin for collectd
  7. hiredis.x86_64 : Minimalistic C client library for Redis
  8. hiredis-devel.x86_64 : Development files for hiredis
  9. opensips-redis.x86_64 : Redis connector
  10. pcp-pmda-redis.x86_64 : Performance Co-Pilot (PCP) metrics for Redis
  11. perl-Apache-Session-Redis.noarch : Redis driver for Apache::Session::NoSQL
  12. perl-Redis.noarch : Perl binding for Redis database
  13. php-nrk-Predis.noarch : PHP client library for Redis
  14. php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
  15. php-phpiredis.x86_64 : Client extension for Redis
  16. python-redis.noarch : Python 2 interface to the Redis key-value store
  17. python-trollius-redis.noarch : Redis client for the Python event loop PEP3156 for Trollius.
  18. python2-django-redis.noarch : Full featured redis cache backend for Django
  19. redis-trib.noarch : Cluster management script for Redis
  20. rubygem-redis.noarch : A Ruby client library for Redis
  21. rubygem-redis-doc.noarch : Documentation for rubygem-redis
  22. syslog-ng-redis.x86_64 : redis support for syslog-ng
  23. uwsgi-logger-redis.x86_64 : uWSGI - redislog logger plugin
  24. uwsgi-router-redis.x86_64 : uWSGI - Plugin for Redis router support
  25. redis.x86_64 : A persistent key-value database
  26. Name and summary matches only, use "search all" for everything.
  27. redis.x86_64 : A persistent key-value database
  28. Name and summary matches only, use "search all" for everything.

如果Redis安装源不存在,先下载安装源信息

  1. #下载fedora的epel仓库
  2. yum install epel-release

2、安装Redis

  1. yum install redis.x86_64 -y

3、配置Redis

  1. vim /etc/redis.conf

4、配置访问密码

  1. ################################## SECURITY ###################################
  2. requirepass password

5、查看Redis后台访问进程

  1. ps aux|grep redis
  2. root 32523 0.0 0.3 142956 5816 pts/1 Sl 16:18 0:00 redis-server 127.0.0.1:6379
  3. root 32566 0.0 0.0 112704 976 pts/1 R+ 16:30 0:00 grep --color=auto redis
  4. root 32566 0.0 0.0 112704 976 pts/1 R+ 16:30 0:00 grep --color=auto redis

6、杀掉原有Redis进程

  1. kill -9 32523

7、加载有密码的Redis,必须加载配置文件启动Redis进程,否则密码不生效。

  1. redis-server /etc/redis.conf &

8、访问Redis服务器

  1. redis-cli

9、查看全部Key信息

  1. 127.0.0.1:6379> keys *

提示

  1. (error) NOAUTH Authentication required.

10、输入密码访问

  1. auth password

提示

  1. OK

发表评论

表情:
评论列表 (有 0 条评论,514人围观)

还没有评论,来说两句吧...

相关阅读