[install redis redis-3.0.7]

Download the installation package redis Source

[root@k8smaster ~]# wget "http://download.redis.io/releases/redis-3.0.7.tar.gz"
[root@k8smaster redis]# pwd
/data/redis
[root@k8smaster redis]# ls -lrt
total 1344
-rw-r--r-- 1 root root 1375200 Jan 28  2016 redis-3.0.7.tar.gz

Compile and install

[root@k8smaster redis]# tar -xf redis-3.0.7.tar.gz #解压
[root@k8smaster redis]# 
[root@k8smaster redis-3.0.7]# yum install gcc* 安装编译工具gcc
[root@k8smaster redis-3.0.7]# make
cd src && make all
make[1]: Entering directory `/data/redis/redis-3.0.7/src'
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory #使用 make MALLOC=libc进行编译
 #include <jemalloc/jemalloc.h>
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/data/redis/redis-3.0.7/src'
make: *** [all] Error 2
[root@k8smaster redis-3.0.7]# 
[root@k8smaster redis-3.0.7]# make MALLOC=libc  # 默认make MALLOC=jemalloc
Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory `/data/redis/redis-3.0.7/src'
[root@k8smaster redis-3.0.7]# cd src/
[root@k8smaster src]# make install
Hint: It's a good idea to run 'make test' ;)
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
[root@k8smaster src]#

Start configuration

Easy to manage, move the conf configuration file Redis files and frequently used commands into a unified file
[root @ k8smaster redis] # mkdir redis
[root @ k8smaster redis] # cd redis
[root @ k8smaster redis] # mkdir bin # store redis command
[@ k8smaster the root Redis] # mkdir config file storage configuration #
[@ k8smaster the root Redis] -lrt LS #
Total 0
drwxr the root-XR-2 X the root. 6 On Feb. 11 13:29 bin
drwxr XR-2 X-On Feb the root the root. 6 13:29 config. 11
[@ k8smaster the root Redis] # pwd
/ Data / Redis / Redis
[@ k8smaster the root Redis] #
[@ k8smaster the src the root] # CP-Benchmark mkreleasehdr.sh Redis Redis Redis-AOF-Check-Check the dump- redis-cli redis-server ../../redis/bin/ # copy command
[@ k8smaster the root-Redis 3.0.7] # CP redis.conf / Data / Redis / Redis / config / copy the configuration file #
[root @ k8smaster bin] # vim /data/redis/redis/config/redis.conf # edit the configuration file
#daemonize NO
daemonize yes # # modified daemonize to yes, to run in daemon mode
# 127.0.0.1 the bind
the bind 192.168.23.100 # to include support for external network, including all IP
logfile /data/redis/redis/log/redis.log # set the log file
the LogLevel Debug
# requirepass foobared
requirepass password 123456 #

[root @ k8smaster bin] # ./redis-server /data/redis/redis/config/redis.conf # start Redis
[root @ k8smaster bin] #
[root @ k8smaster bin] # netstat-APN | grep Redis #Redis Server default port 6379
TCP 0 0 0.0.0.0:6379 0.0.0.0:* the LISTEN-Server 3866 /./ Redis 
TCP6 0 0 ::: ::: * 6379 3866 /./ Redis the LISTEN-Server 
[@ k8smaster the root bin] # 

[root @ k8smaster bin] # ./redis-cli -h 192.168.23.100 -a -p 6379 123456 # client access, test
192.168.23.100:6379> the ping
PONG
192.168.23.100:6379> 
192.168.23.100:6379> the SET zhaiky the Test
the OK
192.168.23.100:6379> GET the Test
"zhaiky"
192.168.23.100:6379> 

[@ k8smaster the root bin] # ./redis-cli -H 192.168.23.100 -a -p 6379 # 123456 Close the shutdown Redis
3885: On Feb 13 is M. 11: 55: 38.051 - DB 0: Keys. 1 (0 volatile) in slots. 4 . the HT
3885: On Feb 13 is M. 11: 55: 38.051 - Connected Clients 0 (0 slaves), 832 176 bytes in use
3885: On Feb 13 is M. 11: 55: 39.839 - Accepted 192.168.23.100:40462
3885: On Feb. 11 M 13:55 : 39.839 the User requested the shutdown ... #
3885: M 11 Feb 13: 55: 39.839 * . Saving at the Final RDB the before exiting the Snapshot # service. after receiving the command to stop the service, and did not stop running immediately, but made a Saving operation, thus, if the kill -9 pid way to kill redis process, could lead to some data loss!
3885: M 11 Feb 13: 55: 39.844 * DB saved ON Disk
3885: M 11 Feb 13: 55:. 39.844 * Removing at The pid File
3885: M 11 Feb 13: 55: 39.844 # Redis IS now READY to Exit, BYE bye ..
 

Published 60 original articles · won praise 20 · views 4580

Guess you like

Origin blog.csdn.net/zhaikaiyun/article/details/105004699