Centos7 编译redis 服务启动方式


安装:
yum install gcc tcl -y
http://download.redis.io/redis-stable.tar.gz
tar -xvzf redis-stable.tar.gz
cd redis-stable
make && make install
cd utils
./install_server.sh
指定路径:/usr/local/bin/redis-server

配置密码:
vim /etc/redis/6379.conf
    bind 10.200.124.123
    requirepass xxxxxxxx

service redis_6379 restart

设置订阅
echo "notify-keyspace-events $szK" >>/etc/redis/6379.conf
redis-cli config set notify-keyspace-events $szK

订阅

redis-cli --csv psubscribe __keyspace@0__:test:bellliu:user_msg

发布

redis-cli publish __keyspace@0__:test:bellliu:user_msg 12456

配置防火墙

firewall-cmd --permanent --add-port=6379/tcp
systemctl restart firewalld