Home  >  Article  >  Database  >  redis-安装

redis-安装

WBOY
WBOYOriginal
2016-06-07 15:28:541004browse

1,下载redis包,解压, 2,进入redis主目录,make 3,sudo make install 进入/tmp 目录下 3.1、 配置init脚本: sudo wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server sudo wget https://github.com/ijonas/dotfiles/raw/maste

1,下载redis包,解压,
2,进入redis主目录,make
3,sudo make install

进入/tmp 目录下

3.1、 配置init脚本:
sudo wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server
sudo wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
sudo mv redis-server /etc/init.d/redis-server
sudo chmod +x /etc/init.d/redis-server
sudo mv redis.conf /etc/redis.conf

3.2、 初始化用户和日志路径
第一次启动Redis前,建议为Redis单独建立一个用户,并新建data和日志文件夹
sudo useradd redis
sudo mkdir -p /var/lib/redis
sudo mkdir -p /var/log/redis
sudo chown redis.redis /var/lib/redis
sudo chown redis.redis /var/log/redis

注:redis 为新增用户,也可以使用当前系统默认用户(例如:homer),
则需修改 sudo chown homer.redis /var/lib/redis


3.3、 设置开机自动启动,关机自动关闭
update-rc.d redis-server defaults

3.4、 启动Redis:
sudo /etc/init.d/redis-server start

3.5、检查启动是否成功:
ps -ef | grep redis

6、 启动client客户端连接

$ redis-cli
redis> set foo bar
OK
redis> get foo
"bar"


7、关闭redis

redis-cli shutdown






Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn