CentOS7下安装Redis服务

1、查看Redis安装源

yum search redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
==================================================================================== N/S matched: redis =====================================================================================
collectd-redis.x86_64 : Redis plugin for collectd
collectd-write_redis.x86_64 : Redis output plugin for collectd
hiredis.x86_64 : Minimalistic C client library for Redis
hiredis-devel.x86_64 : Development files for hiredis
opensips-redis.x86_64 : Redis connector
pcp-pmda-redis.x86_64 : Performance Co-Pilot (PCP) metrics for Redis
perl-Apache-Session-Redis.noarch : Redis driver for Apache::Session::NoSQL
perl-Redis.noarch : Perl binding for Redis database
php-nrk-Predis.noarch : PHP client library for Redis
php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php-phpiredis.x86_64 : Client extension for Redis
python-redis.noarch : Python 2 interface to the Redis key-value store
python-trollius-redis.noarch : Redis client for the Python event loop PEP3156 for Trollius.
python2-django-redis.noarch : Full featured redis cache backend for Django
redis-trib.noarch : Cluster management script for Redis
rubygem-redis.noarch : A Ruby client library for Redis
rubygem-redis-doc.noarch : Documentation for rubygem-redis
syslog-ng-redis.x86_64 : redis support for syslog-ng
uwsgi-logger-redis.x86_64 : uWSGI - redislog logger plugin
uwsgi-router-redis.x86_64 : uWSGI - Plugin for Redis router support
redis.x86_64 : A persistent key-value database

  Name and summary matches only, use "search all" for everything.

2、安装Redis

yum install redis.x86_64 -y

3、配置Redis

vim /etc/redis.conf

4、配置访问密码

################################## SECURITY ###################################
requirepass password

5、查看Redis后台访问进程

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

6、杀掉原有Redis进程

kill -9 32523

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

redis-server /etc/redis.conf &

8、访问Redis服务器

redis-cli

9、查看全部Key信息

127.0.0.1:6379> keys *

提示

(error) NOAUTH Authentication required.

10、输入密码访问

auth password

提示

OK


猜你喜欢

转载自blog.csdn.net/fishinhouse/article/details/80900468