001 Redis安装配置

编译

$ yum install -y gcc
$ mkdir /opt/Redis
$ cd /opt/Redis
$ tar -zxvf redis-5.0.5.tar.gz
$ cd /opt/Redis/redis-5.0.5
$ make MALLOC=libc -j4
$ cp /opt/Redis/redis-5.0.5/src/redis-server /usr/local/bin
$ cp /opt/Redis/redis-5.0.5/src/redis-cli /usr/local/bin
$ cp /opt/Redis/redis-5.0.5/src/redis-trib.rb /usr/local/bin
$ mkdir /etc/redis
$ cp /opt/Redis/redis-5.0.5/redis.conf /etc/redis/6379.conf

配置

$ vim /etc/redis/6379.conf
# 注意 192.168.1.170 是redis所在机器上的IP,不能填0.0.0.0报启动失败,提示6379端口占用,但其实并没有redis-server进程,也查不到端口占用:netstat -naop | grep 6379 和  ps aux|grep "redis-server"
bind 127.0.0.1 192.168.1.170
protected-mode no

启动

$ /usr/local/bin/redis-server /etc/redis/6379.conf
$ /usr/local/bin/redis-server /etc/redis/6379.conf --daemonize yes

关闭

$ redis-cli -h 127.0.0.1 -p 6379 shutdown
$ kill -9 $(ps aux | grep -v grep | grep 'redis-server' | awk '{print $2}')

开机启动

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章