Article Directory
1. Download the redis installation package
node01(主节点)服务器执行以下命令下载redis安装包
[root@node01 ~]# cd /export/soft/
[root@node01 soft]# wget http://download.redis.io/releases/redis-3.2.8.tar.gz
2. Unzip the redis compressed package to the specified directory
node01执行以下命令进行解压redis
[root@node01 ~]# cd /export/soft
[root@node01 soft]# tar -zxvf redis-3.2.8.tar.gz -C ../servers/
3. Install C program running environment
node01执行以下命令安装C程序运行环境
[root@node01 ~]# yum -y install gcc-c++
4. Install a newer version of tcl
[root@node01 ~]# yum -y install tcl
5. Compile redis
node01执行以下命令进行编译:
[root@node01 ~]# cd /export/servers/redis-3.2.8/
[root@node01 redis-3.2.8]# make MALLOC=libc 或者使用命令 make 进行编译
[root@node01 redis-3.2.8]# make test && make install
6. Modify the redis configuration file
[root@node01 ~]# cd /export/servers/redis-3.2.8/
[root@node01 redis-3.2.8]# mkdir -p /export/servers/redis-3.2.8/logs
[root@node01 redis-3.2.8]# mkdir -p /export/servers/redis-3.2.8/redisdata
[root@node01 redisdata]# vim redis.conf
bind node01
daemonize yes
pidfile /var/run/redis_6379.pid
logfile "/export/servers/redis-3.2.8/logs/redis.log"
dir /export/servers/redis-3.2.8/redisdata
7. Start redis
node01执行以下命令启动redis
[root@node01 ~]# cd /export/servers/redis-3.2.8/src
[root@node01 src]# redis-server ../redis.conf
8. Connect to the redis client
node01执行以下命令连接redis客户端
[root@node01 ~]# cd /export/servers/redis-3.2.8/src
[root@node01 src]# redis-cli -h node01