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}')

開機啓動

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