Linux redis安装
来源:互联网 发布:软件项目开发流程 编辑:程序博客网 时间:2024/06/16 00:16
转载自:http://my.oschina.net/xinxingegeya/blog/212348#OSC_h2_9(写的很好)
安装准备:redis2.8.7,redhat
只供参考
1. 解压
[root@dell1 soft]# tar -xzvf redis-2.8.7.tar.gz
2. 进入解压后的目录,直接执行make命令
[root@dell1 soft]# cd redis-2.8.7 [root@dell1 redis-2.8.7]# pwd /home/soft/redis-2.8.7 [root@dell1 redis-2.8.7]# make
3. 执行make test
执行成功make命令后,会提示执行make test,如果没有安装tcl,则会报错
报错,提示没有You need ‘tclsh8.5’ in order to run the Redis test,
所以接下来应该安装tcl,这个不清楚是什么东西。下载tcl8.6.1
#cd tcl8.6.1/unix/ #./configure #make #make test #make install
这样应该完成安装完tcl了
4. 回到redis的安装目录重新执行make test
\o/ All tests passed without errors! make test执行成功Cleanup: may take some time... OK make[1]: Leaving directory `/home/soft/redis-2.8.7/src'
5. 执行make install
[root@dell1 redis-2.8.7]# make install
6. 执行install_server.sh文件
[root@dell1 redis-2.8.7]# cd utils/ [root@dell1 utils]# ls build-static-symbols.tcl redis-copy.rb speed-regression.tcl generate-command-help.rb redis_init_script whatisdoing.sh install_server.sh redis_init_script.tpl mkrelease.sh redis-sha1.rb [root@dell1 utils]# ./install_server.shWelcome to the redis service installer This script will help you easily set up a running redis serverPlease 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] s#^port [0-9]{4}$#port 6379#;s#^logfile .+$#logfile /var/log/redis_6379.log#;s#^dir .+$#dir /var/lib/redis/6379#;s#^pidfile .+$#pidfile /var/run/redis_6379.pid#;s#^daemonize no$#daemonize yes#; Copied /tmp/6379.conf => /etc/init.d/redis_6379 Installing service... ./install_server.sh: line 178: update-rc.d: command not found exists, process is already running or crashed Installation successful!
执行完成。这里使用了默认配置
7. 启动redis服务
[root@dell1 utils]# cd /usr/local/bin [root@dell1 bin]# ls event_rpcgen.py memcached-debug redis-check-aof redis-cli tclsh8.6 memcached redis-benchmark redis-check-dump redis-server [root@dell1 bin]# ./redis-server /etc/redis/6379.conf
8. 查看服务是否启动
[root@dell1 bin]# ps -ef | grep 6379 root 3206 1 0 13:06 ? 00:00:00 /usr/local/bin/redis-server *:6379 root 7996 3294 0 13:45 pts/0 00:00:00 grep 6379
9. 修改redis启动文件
在/etc/rc.d/init.d/下有一个默认文件redis_6379,打开文件,修改后如下
#/bin/sh #Configurations injected by install_server below.... EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_6379.pid CONF="/etc/redis/6379.conf" REDISPORT="6379"case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -p $REDISPORT shutdown while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; *) echo "Please use start or stop as first argument" ;; esac
保存退出
10. 更改redis_6379的名字
[root@dell1 init.d]# mv redis_6379 redis
11. 刚才已经启动服务,现在使用service关闭服务,开启服务
[root@dell1 bin]# service redis stop Stopping ... Redis stopped [root@dell1 bin]# service redis start Starting Redis server...
12. 使用redis-cli登录
[root@dell1 bin]# cd /usr/local/bin [root@dell1 bin]# ls event_rpcgen.py memcached-debug redis-check-aof redis-cli tclsh8.6 memcached redis-benchmark redis-check-dump redis-server [root@dell1 bin]# ./redis-cli 127.0.0.1:6379> set key 122 OK 127.0.0.1:6379> get key "122" 127.0.0.1:6379> exists key (integer) 1
====END====
0 0
- [Redis] Linux系统安装Redis
- Redis--Linux下安装Redis
- Redis 简介、Linux 安装 Redis、Redis 使用
- linux平台Redis安装
- linux 4.5 安装Redis
- linux 安装redis数据库
- linux安装Redis服务器
- linux下redis安装
- linux redis 安装配置
- Linux Redis安装
- linux安装redis
- Linux redis安装
- linux下安装redis
- linux平台Redis安装
- linux安装redis
- linux平台Redis安装
- Linux下安装redis
- Linux安装redis
- datetimepicker用法
- 从wireshark 抓包中的导出 H.264 变成可用暴风直接播放的H264 裸码流文件
- 【Android】Activity全屏显示解决方案
- _weak typeof(self) weakSelf = self 作用及用法
- java发送邮件
- Linux redis安装
- peugeot 2008 5 door
- table_definition_cache
- AngularJS入门教程:导言和准备
- Struts2中出现严重: Dispatcher initialization failed错误
- 帐号泄露事件频发,到底什么样的密码才安全?
- kafka入门:简介、使用场景、设计原理、主要配置及集群搭建
- 107.View the Exhibit and examine the structure and data in the INVOICE table.
- 【leetcode】【122】Best Time to Buy and Sell Stock II