Redis正常安装

通常安装方法:

[root@node110 redis]# pwd

/usr/local/src/redis

 

解压安装:

tar zxf redis-3.2.6.tar.gz

cd redis-3.2.6

make PREFIX=/usr/local/redis326 install

 

修改redis启动脚本:

[root@node110 utils]# pwd

/usr/local/src/redis/redis-3.2.6/utils

[root@node110 utils]# vim redis_init_script

 

添加以下内容:

# chkconfig: 2345 55 25

# description:redis 3.2.6

#

REDISPORT=6379

EXEC=/usr/local/redis326/bin/redis-server

CLIEXEC=/usr/local/redis326/bin/redis-cli

 

PIDFILE=/var/run/redis_${REDISPORT}.pid

CONF="/etc/redis326/${REDISPORT}.conf"

 

复制启动脚本到/etc/init.d

cp redis_init_script /etc/init.d/redis

chmod 755 /etc/init.d/redis

 

将源代码中的redis配置文件复制到/etc/redis326目录下:

[root@node110 redis-3.2.6]# cp redis.conf/etc/redis326/

[root@node110 redis-3.2.6]# pwd          

/usr/local/src/redis/redis-3.2.6

[root@node110 redis-3.2.6]# cd /etc/redis326/

[root@node110 redis326]# ls

redis.conf

[root@node110 redis326]# mv redis.conf 6379.conf

[root@node110 redis326]# ls

6379.conf

 

修改配置文件,让redis以后台进程的方式运行

 126 # Bydefault Redis does not run as a daemon. Use 'yes' if you need it.

 127 # Note thatRedis will write a pid file in /var/run/redis.pid when daemonized.

 128 #daemonizeno

 129 daemonizeyes

 

 

 

将启动脚本加入服务管理:

[root@node110 redis326]# chkconfig redis on

[root@node110 redis326]# chkconfig --list | grep redis

redis            0:off      1:off      2:on      3:on      4:on      5:on      6:off

 

启动redis服务:

[root@node110 redis326]# /etc/init.d/redis start

Starting Redis server...

 

[root@node110 redis326]# service redis start

Starting Redis server...

 

查看进程与端口:

[root@node110 redis326]# ps -ef | grep redis

root     4977  1907  0 20:58 pts/1    00:00:00 vim redis.conf

root     5029  1907  0 21:10 pts/1    00:00:00 vim redis.conf

root     5031  1907  0 21:11 pts/1    00:00:00 vim redis_init_script

root     5043  1907  0 21:14 pts/1    00:00:00 vim redis

root     5111     1  0 21:23 ?        00:00:00/usr/local/redis326/bin/redis-server 127.0.0.1:6379        

root     5125  1907  0 21:24 pts/1    00:00:00 grep --color=auto redis

[root@node110 redis326]# netstat -lntup | grep redis

tcp       0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      5111/redis-server 1

 

 

 

 

 

 

 

 

分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS