码迷,mamicode.com
首页 > 其他好文 > 详细

Redis的安装

时间:2018-07-17 12:34:39      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:准备   images   term   --   ln -s   list   lis   微软雅黑   下载   

下载链接:

https://redis.io/download

http://download.redis.io/releases/redis-3.2.12.tar.gz



编译安装

/usr/local # tar zxf redis-3.2.12.tar.gz

/usr/local # cd redis-3.2.12/

/usr/local/redis-3.2.12 # make


/usr/local/redis-3.2.12 # cd ..

/usr/local # ln -s redis-3.2.12 redis



创建redis用户

/usr/local # useradd redis


切换到redis用户,之后所有操作都在该用户下

/usr/local # su - redis


设置PATH环境变量

PATH=$PATH:$HOME/bin:/usr/local/redis/src


~ $ redis-server --version

Redis server v=3.2.12 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=87e1321a1f29cac8


创建redis实例需要的目录

~ $ mkdir -pv keepmoving/6379/{conf,data,log}

mkdir: created directory `keepmoving'

mkdir: created directory `keepmoving/6379'

mkdir: created directory `keepmoving/6379/conf'

mkdir: created directory `keepmoving/6379/data'

mkdir: created directory `keepmoving/6379/log'


准备配置文件

~/keepmoving/6379/conf $ cat redis.conf 

bind 0.0.0.0

port 6379

unixsocket /home/redis/keepmoving/6379/log/redis.sock

daemonize yes

pidfile /home/redis/keepmoving/6379/log/redis.pid

loglevel debug

logfile /home/redis/keepmoving/6379/log/redis.log

dir /home/redis/keepmoving/6379/data



启动,登陆redis

~ $ redis-server /home/redis/keepmoving/6379/conf/redis.conf


~ $ ss -ln | grep 6379

LISTEN     0      128                       *:6379                     *:*


~ $ redis-cli -p 6379

127.0.0.1:6379> ping

PONG

127.0.0.1:6379> ping "hello redis"

"hello redis"

127.0.0.1:6379>


若感兴趣可关注订阅号”数据库最佳实践”(DBBestPractice).

技术分享图片

Redis的安装

标签:准备   images   term   --   ln -s   list   lis   微软雅黑   下载   

原文地址:http://blog.51cto.com/coveringindex/2145292

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!