Redis安装

原创 2016年08月30日 22:45:55

Ubuntu安装Redis


1.redis配置文件

redis.cof

protected-mode no
port 6379
daemonize yes
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
 requirepass qwer1234
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

2.redis启动脚本

redis启动脚本redis_init_script在redis/utils路径下,修改redis_init_script,拷贝到/etc/init.d/下,重命名为redisd,d表示后台服务。

#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.

#redis服务器监听的端口
REDISPORT=6379
#redis密码
PASSWORD=qwer1234
#服务端所处位置,在make install后默认存放与`/usr/local/bin/redis-server`,如果未make install则需要修改该路径,下同。
EXEC=/home/hurry/mySoftware/redis-3.2.1/src/redis-server
#客户端路径
CLIEXEC=/home/hurry/mySoftware/redis-3.2.1/src/redis-cli

#redis的PID文件路径
PIDFILE=/var/run/redis/${REDISPORT}.pid
#配置文件路径
CONF=/etc/redis/${REDISPORT}.conf

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 -a $PASSWORD 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

3.新建文件路径

配置文件要求存在这些路径,必须手动创建,否则报错。

#创建pid文件路径
$ sudo mkdir -p /var/run/redis
$ sudo chown -R hurry:hurry /var/run/redis

#创建配置文件路径
$ sudo mkdir /etc/redis
$ sudo chown -R hurry:hurry /etc/redis
$ cp -a redis.conf /etc/redis/6379.conf

4.启动/关闭redis

$ /etc/init.d/redisd start 
$ /etc/init.d/redisd stop

#查看是否启动成功
$ ps -ef|grep redis
版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

Redis详细安装

Redis主从服务器安装配置

Redis的介绍 数据库主要类型有对象数据库,关系数据库,键值数据库等等,对象数据库太超前了,现阶段不提也罢;关系数据库就是平常说的MySQL,PostgreSQL这些熟的不能再熟的东西,至于键...
  • zqtsx
  • zqtsx
  • 2013-06-03 16:19
  • 2295

Redis-x64-3.2.100 安装包

  • 2017-08-03 16:56
  • 5.80MB
  • 下载

redis数据库安装包

  • 2017-10-10 13:26
  • 1.30MB
  • 下载

censtos下redis主备安装

centos下redis安装,主备安装,redis-sentinel安装

Redis安装配置

  • 2017-09-21 22:18
  • 305KB
  • 下载

Windows下安装部署redis cluster

  • 2016-11-25 12:02
  • 41.01MB
  • 下载

Redis的安装和配置(centos6.7)

安装redis 下载 wget http://redis.googlecode.com/files/redis-2.2.12.tar.gz 不过翻墙也是麻烦事,就直接在redis里面手动下载了,我下...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)