redis基本配置

Posted bazingafraser

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redis基本配置相关的知识,希望对你有一定的参考价值。

1、安装Redis
 
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
yum install tcl -y
tar zxf redis-2.8.19.tar.gz
cd redis-2.8.19
make MALLOC=libc
make test    //这一步时间会稍久点...
make install
 
cd utils/
./install_server.sh     //脚本执行后,所有选项都以默认参数为准即可
Welcome to the redis service installer
This script will help you easily set up a running redis server
 
Please 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] 
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
 
 
2、查看redis的监控端口
 
elk:~ # netstat -ntlp |grep redis
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 12420/redis-server
 
 
3、测试redis是否正常工作
 
# cd redis-2.8.19/src/
# ./redis-cli -h 192.168.1.104 -p 6379 //连接redis
192.168.1.104:6379> ping
PONG
192.168.1.104:6379> set name zhengyansheng
OK
192.168.1.104:6379> get name
"zhengyansheng"
192.168.1.104:6379> quit
 
4、redis的动态监控
 
# cd redis-2.8.19/src/
# ./redis-cli monitor     //reids动态监控
Ok

以上是关于redis基本配置的主要内容,如果未能解决你的问题,请参考以下文章

dtcms5.0 redis怎么配置

Redis6.0.9配置redis集群

如何在redis配置文件中查看redis版本

windows下redis配置文件是哪个

Redis配置详解

Linux下安装配置redis详细教程,并配置哨兵模式