安装Redis并配置服务
#安装gcc
yum -y install gcc
#下载redis
curl -O http://download.redis.io/releases/redis-3.2.8.tar.gz
#解压
tar -zxvf redis-3.2.8.tar.gz
#转换目录
cd redis-3.2.8/deps/
#编译依赖
make geohash-int hiredis jemalloc linenoise lua
#转换目录
cd ..
#编译Redis
make && make install
#转换目录
cd utils/
#使用脚本安装服务
./install_server.sh
#启动服务
systemctl start redis_6379
systemctl status redis_6379
Redis开启远程访问
# 查找Redis配置(注意不是安装目录下的redis.conf)
# 打开第五步设计的Redis配置,默认为:/etc/redis/6379.conf
# 修改配置文件如下几项,其它保持不变
daemonize yes
#bind 127.0.0.1 (注释,不限制IP)
protected-mode no
将 requirepass foobared前的“#”去掉,密码改为你想要设置的密码(我设置为123456)
# 重启服务
[root@172 redis-3.2.11]# service redis_6379 restart
Stopping ...
Redis stopped
Starting Redis server...
# 开放6379端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
# 重启防火墙,否则开放端口不起作用
firewall-cmd --reload
sudo systemctl enable redis_6379//开机自动启动redis服务
评论区