CentOS7.2 安装Redis3.2.8
下载Redis3.2.8.tar.gz
将文件放置在usr/local/redis/中
解压文件
安装:
make && make install
[root@localhost redis-3.2.8]# make && make install
进入usr/local/redis/redis-3.2.8/utils文件夹
./install_server.sh
详情:
[root@localhost utils]# ./install_server.sh Welcome to the redis service installer This script will help you easily set up a running redis server Please select the redis port for this instance: [6379] Selecting default: 6379 Please select the redis config file name [/etc/redis/6379.conf] Selected default - /etc/redis/6379.conf Please select the redis log file name [/var/log/redis_6379.log] Selected default - /var/log/redis_6379.log Please select the data directory for this instance [/var/lib/redis/6379] Selected default - /var/lib/redis/6379 Please select the redis executable path [/usr/local/bin/redis-server] Selected config: Port : 6379 Config file : /etc/redis/6379.conf Log file : /var/log/redis_6379.log Data dir : /var/lib/redis/6379 Executable : /usr/local/bin/redis-server Cli Executable : /usr/local/bin/redis-cli Is this ok? Then press ENTER to go on or Ctrl-C to abort. Copied /tmp/6379.conf => /etc/init.d/redis_6379 Installing service... Successfully added to chkconfig! Successfully added to runlevels 345! Starting Redis server... Installation successful!
从上面可以看出redis的配置文件路径。
启动服务:
systemctl start redis_6379
systemctl status redis_6379
详情:
[root@localhost ~]# systemctl start redis_6379 [root@localhost ~]# systemctl status redis_6379 ● redis_6379.service - LSB: start and stop redis_6379 Loaded: loaded (/etc/rc.d/init.d/redis_6379; bad; vendor preset: disabled) Active: active (exited) since 六 2017-04-08 23:03:01 CST; 9s ago Docs: man:systemd-sysv-generator(8) Process: 10566 ExecStart=/etc/rc.d/init.d/redis_6379 start (code=exited, status=0/SUCCESS) 4月 08 23:03:01 localhost.localdomain systemd[1]: Starting LSB: start and stop red.... 4月 08 23:03:01 localhost.localdomain redis_6379[10566]: /var/run/redis_6379.pid ex... 4月 08 23:03:01 localhost.localdomain systemd[1]: Started LSB: start and stop redi.... Hint: Some lines were ellipsized, use -l to show in full.
修改6379.conf
修改 bind 127.0.0.1 为 bind 0.0.0.0