数据库
首页 > 数据库> > 【Redis】Redis5.0环境搭建

【Redis】Redis5.0环境搭建

作者:互联网

一、下载安装RedisServer

$ wget http://download.redis.io/releases/redis-5.0.3.tar.gz
$ tar xzf redis-5.0.3.tar.gz
$ cd redis-5.0.3
$ make && make install
完成上面步骤之后,Redis相关bin文件件就已经安装到/usr/bin/local目录下了

二、配置RedisServer

 

$ mkdir –p /data/redis
$ cat > /data/redis/redis.conf << 'EOF'
port 6379 bind 0.0.0.0
#cluster-enabled yes
#cluster-config-file nodes.conf
#cluster-node-timeout 5000 appendonly yes
EOF

 

 

启动RedisServer

$ cd /data/redis
$ /usr/local/bin/redis-server ./redis.conf

  

三、配置守护进程

$ vim /etc/systemd/system/redis-6379.service

[Unit]
Description=redis service

[Service]
WorkingDirectory=/data/redis/
ExecStart=/usr/local/bin/redis-server /data/redis/redis.conf
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=redis-service
User=root

[Install]
WantedBy=multi-user.target

  

$ systemctl enable redis-6379.service

Created symlink from /etc/systemd/system/multi-user.target.wants/redis-6379.service to /etc/systemd/system/redis-6379.service.

  

四、使用 # 启动服务
$ systemctl start redis-6379.service
  # 检查服务状态
systemctl status redis-6379.service
  # 再通过netstat –nltp查看开放的端口,
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 5687/redis-server 0

  

至此,Redis Server已经安装配置好,服务器重启之后也会自动启动

 

标签:bin,service,redis,Redis,6379,Redis5.0,0.0,data,搭建
来源: https://www.cnblogs.com/lanse1993/p/12582021.html