详细的redis安装步骤可参考我的另一篇文章:http://meiling.blog.51cto.com/6220221/1979156
1、普通用户安装redis
[[email protected] ~]$ tar -xfredis-4.0.2.tar.gz [[email protected] ~]$ cd redis-4.0.2 [[email protected] redis-4.0.2]$ make [[email protected] redis-4.0.2]$ sudo make install
2、普通用户下用sudo命令以root启动
2.1. 以root身份启动redis服务
$ sudo /usr/local/bin/redis-server/home/centos6/redisconf/redis.conf [[email protected] ~]$ ps -ef |grep redis root 33547 1 0 09:52 ? 00:00:00 /usr/local/bin/redis-server127.0.0.1:7200 centos6 33552 33452 0 09:52 pts/1 00:00:00 grep redis
2.2. 停止redis服务也要用sudo来执行root权限:
$ sudo /usr/local/bin/redis-cli -p 7200 shutdown
3、以普通用户来启动redis:
3.1. 修改pid生成路径为普通用户下,自己定义
$ vi /home/centos6/redisconf/redis.conf $ pidfile/home/centos6/redisconf/run/redis_7200.pid
启动redis服务:
$ /usr/local/bin/redis-server/home/centos6/redisconf/redis.conf
以普通用户停止redis:
/usr/local/bin/redis-cli -p 7200 shutdown
时间: 2024-11-25 14:40:00