linux下安装redis并配置
redis官网上给出了安装步骤,这里做一下总结。
1、Download, extract and compile Redis with:
wget http://download.redis.io/releases/redis-5.0.2.tar.gz tar -zxvf redis-5.0..tar.gz
cd redis-5.0. yum install -y gcc
# 直接使用make命令会出现以下错误
fatal error: jemalloc/jemalloc.h: No such file or directory make MALLOC=libc # 直接make test会出现以下错误
You need tcl 8.5 or newer in order to run the Redis test
# 解决方法
yum install -y tcl
make test
2、配置并启动redis。
# 备份redis配置文件
cp redis.conf redis.conf.bak
a>配置reids为后台驻留程序。打开redis.conf,找到daemonize,可以看到reids默认情况下不是后台驻留程序。
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# daemonize no
# 修改成:
daemonize yes
b-1>配置redis log文件路径。
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
# logfile ""
# 修改为如下,意思为把log文件放在redis安装目下logs/redis.log(要自己创建好目录结构)
logfile "logs/redis.log"
b-2>配置db file location
# The working directory.
# dir ./
dir /usr/local/redis-5.0.2/
c>配置redis远程连接
#注释掉所有bind 127.0.0.1
#bind 127.0.0.1 ::
#bind 127.0.0.1
bind 0.0.0.0 #创建密码
requirepass password
d>创建redis用户
groupadd gredis
useradd -r -g gredis -s /bin/false redis
e>修改redis目录拥有者为redis:redis
chown -R redis:gredis ./
f>启动redis
# redis3.x
# 启动redis。禁止使用root启动!!!注意可能造成的文件的读写权限。
# 修改redis.conf文件后需指定配置文件路径启动
sudo -u redis src/redis-server ./redis.conf # redis客户端连接命令
src/redis-cli -h 127.0.0.1 -p -a password #
g>关闭redis
src/redis-cli shutdown # 强制关闭redis,找到redis进程号,kill掉。
netstat -anp | grep redis
tcp 127.0.0.1: 0.0.0.0:* LISTEN /src/redis-serv
kill -
可能遇到的问题:
1、在执行src/redis-cli shutdown时报错:“(error) ERR Errors trying to SHUTDOWN. Check logs.”。日志(上面配置了日志路径)如下:
# User requested shutdown...
* Saving the final RDB snapshot before exiting.
# Failed opening the RDB file dump.rdb (in server root dir /usr/local/redis-3.2.) for saving: Permission denied
# Error trying to save the DB, can't exit.
解决方法:
You should check your redis.conf file to see the permissions in dir and dbfilename.
If the file named in the dbfilename which is located in the path specified in the
dir path exists and the permission is also right. then the problem should be fixed. Hope this will help someone. P.S. To find the redis.conf file location, you can use the #ps ax | grep redis to check.
Usually it will be passed to the redis-server as input file. For the dir permissions:it should be , for the dbfilename, it should be Sometimes you also need to use top command to check whether the user:group of
the redis-server and the owner of dir are consistent.
i.e. The redis-server is running by redis:redis, but the dir is under root:root.
In this case, you need to chown redis:redis -R dir.
QQ技术交流群:282575808
--------------------------------------
声明: 原创文章,未经允许,禁止转载!
--------------------------------------
linux下安装redis并配置的更多相关文章
- linux 下安装redis以及php Redis扩展
[php] view plaincopy在CODE上查看代码片派生到我的代码片 linux 下安装redis以及php Redis扩展 环境配置: centos6. nginx/ php/ mysql ...
- Linux 下安装 Redis server
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/defonds/article/details/30047611 本文简介了 Linu ...
- Linux下安装Redis及搭建主从
Linux下安装Redis 首先在官网下载对应版本的redis包,这里本人使用的是redis-4.0.8.tar.gz. 然后在服务器中存放redis包的路径下执行tar –vxf redis-4 ...
- linux 下安装jdk及配置jdk环境图解
linux 下安装jdk及配置jdk环境图解 一:先检測是否已安装了JDK 运行命令: # rpm -qa|grep jdk 或 # rpm -q jdk 或 #find / -name j ...
- Linux下安装Java环境配置
1.下载安装文件 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 2. ...
- mac mamp环境 和linux下 安装redis 和可视化工具 Redis Desktop Manager
mac下安装 第一步:安装redis 1. brew install redis 2.启动服务/usr/local/opt/redis/bin/redis-server 3.配置redis密码访问 编 ...
- Linux 下安装redis
记录一下linux下的安装步骤,还是比较复杂的 1. 下载redis-2.8.19.tar.gz: ftp传到linux01上: 解压: tar –zxvf redis-2.8.19.tar.gz 2 ...
- Linux下安装Redis以及遇到的问题
参考链接:https://www.cnblogs.com/zdd-java/p/10288734.html https://www.cnblogs.com/uncleyong/p/9882843.ht ...
- linux系统下安装redis及配置
下载Redis redis-3.2.11.tar.gz 解压编译 tar xzf redis-3.2.11.tar.gz cd redis-3.2.11 make 编译完成之后,可以看到解压文件red ...
随机推荐
- 如何不使用Navigator空间实现跳转页面?
//引入 Loading页面 主页面 登录页等页面组件 constructor(props) { super(props); this.state = { 登录状态: 等待检查 }; } compon ...
- Android SDK不能够更新
Adroid不能够更新,因为国内将google的服务器墙掉了,在 1) vim /etc/hosts(Windows上路径为:C:\Windows\System32\drivers\etc\hosts ...
- wget常见用法
1.很多软件官网会有安装脚本,并把脚本搞成raw模式,方便下载后直接运行的shell文件.比如docker wget -qO- get.docker.com | bash -q的含义是:--quiet ...
- 一个里表世界切换的shader效果
之前GGJ实现了一个,但是实现方式上有很多冗余.今天正好在做一个类似的东西,重新做了一个版本 还是当时美术画的素材: 由于里表世界是不同的内容,是两张材质.所以拆分成不同Layer之后,里世界单独渲染 ...
- HTTP响应状态码
1XX:代表提示信息 2XX:代表成功信息 3XX:代表重定向 4XX:代表客户端错误信息 5XX:代表服务器错误 信息 500:500 错误是服务器内部错误 ,而且是程序上错误 为多,可能是你的用户 ...
- formidable处理多文件上传
首先,在html页面中,表单上传文件的控件需要加上multiple选项,或者multiple="multiple". 然后,在nodejs程序中处理post数据的路路由中使用for ...
- Fluent UDF【7】:解释型UDF
UDF宏有两种方式可以被Fluent所接受:编译和解释.其中有一些宏既可以被解释也可以被编译,而一些宏则只能被解释.有一些场合只接受编译后的UDF(如动网格中的一些宏),而有些场合既可以接受编译的UD ...
- 最全Java锁详解:独享锁/共享锁+公平锁/非公平锁+乐观锁/悲观锁
在Java并发场景中,会涉及到各种各样的锁如公平锁,乐观锁,悲观锁等等,这篇文章介绍各种锁的分类: 公平锁/非公平锁 可重入锁 独享锁/共享锁 乐观锁/悲观锁 分段锁 自旋锁 01.乐观锁 vs 悲观 ...
- Linux的sysctl 命令参数详解
Linux内核通过/proc虚拟文件系统向用户导出内核信息,用户也可以通过/proc文件系统或通过sysctl命令动态配置内核.比如,如果我们想启动NAT,除了加载模块.配置防火墙外,还需要启动内核转 ...
- Gitlab日常备份和恢复
按照官方安装文档安装完成之后的/home/git目录结构如下,这里我大致翻译官方的内容,部分加上自己的话,英语功力捉急,请见谅 |-- home | |-- git | |-- .ssh | |-- ...