CentOS安装redis
2016-12-08 14:38
197 查看
由于公司的项目需要用到redis技术,这两天就在研究这玩意,首先在linux安装redis
然后下载安装包:
版本可自行去http://download.redis.io/releases/ 选择
下载完毕后就是解压拉
安装依赖(安装过可以省略)
然后我们把redis注册成服务
把 chkconfig: 2345 80 90 加在第二行 2345表示系统运行级别是2,3,4或者5时启动服务,80启动优先级别
90是关闭的优先级别
不过默认启动服务是在前台界面所以需要去修改配置文件
将redis配置文件拷贝到/etc/redis/${REDISPORT}.conf
如果需要密码验证的可以找到# requirepass foobared
把#去掉 把foobared换成自己的密码
#检测后台进程是否存在
#检测6379端口是否在监听
去客户端测试
cd /usr/local
然后下载安装包:
wget http://download.redis.io/releases/redis-3.2.5.tar.gz
版本可自行去http://download.redis.io/releases/ 选择
下载完毕后就是解压拉
tar zvxf redis-3.2.5.tar.gz然后把文件夹改名。。
mv redis-3.2.5.tar.gz redis
安装依赖(安装过可以省略)
yum install gcc然后安装
make make install这时不出意外的话已经安装好了
然后我们把redis注册成服务
cp /usr/local/redis/utils/redis_init_script /etc/rc.d/init.d/redis使用vim修改配置文件
vim /etc/rc.d/init.d/redis
把 chkconfig: 2345 80 90 加在第二行 2345表示系统运行级别是2,3,4或者5时启动服务,80启动优先级别
90是关闭的优先级别
#!/bin/sh #chkconfig: 2345 80 90 # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. .....注册服务:
chkconfig --add redis这时已经可以用命令启动服务了
service redis start
不过默认启动服务是在前台界面所以需要去修改配置文件
将redis配置文件拷贝到/etc/redis/${REDISPORT}.conf
mkdir /etc/redis cp /usr/local/src/redis/redis.conf /etc/redis/6379.conf //修改配置文件 vim /etc/redis/6379.conf修改daemonize为yes,即默认以后台程序方式运行
如果需要密码验证的可以找到# requirepass foobared
把#去掉 把foobared换成自己的密码
requirepass "helloRedis"
#检测后台进程是否存在
ps -ef |grep redis
#检测6379端口是否在监听
netstat -lntp | grep 6379
去客户端测试
cd /usr/local/bin ./redis-cli 127.0.0.1:6379> keys * //如果设置了密码会出现如下错误 (error) NOAUTH Authentication required. //键入auth 加你的密码就可以了 127.0.0.1:6379> auth helloRedis OK 127.0.0.1:6379> keys * (empty list or set) 127.0.0.1:6379> shutdown not connected> quit借阅几篇文章,终于写好了这篇文章
相关文章推荐
- Linux(Centos5.5) redis 安装及redisphp拓展安装应用
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- centos5.5 编译安装 redis2.2.11
- Linux(Centos6。0) redis 安装及redisphp拓展安装应用和redis.conf 的详细解析
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS 下 Redis 2.2 安装配置详解
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS中,安装Apache+PHP+Mongo DB+Redis DB
- CentOS下Redis 2.2.14安装配置详解