zoukankan      html  css  js  c++  java
  • redis 安装配置

    reids 安装配置

    1.1 下载软件包

    [root@node01 ~]# mkdir -p /data/src/
    [root@node01 ~]# cd /data/src/
    [root@node01 src]# wget http://download.redis.io/releases/redis-3.2.5.tar.gz

    1.2 解压安装

    [root@node01 src]# tar zxf redis-3.2.5.tar.gz 
    [root@node01 src]# cd redis-3.2.5
    [root@node01 src]# make
    [root@node01 src]# cd src
    [root@node01 src]# make install PREFIX=/usr/local/redis/

    1.3 检查安装

    [root@node01 src]# ll /usr/local/redis/bin/
    total 26348
    -rwxr-xr-x 1 root root 5580319 Jun 2 11:47 redis-benchmark
    -rwxr-xr-x 1 root root 22185 Jun 2 11:47 redis-check-aof
    -rwxr-xr-x 1 root root 7829986 Jun 2 11:47 redis-check-rdb
    -rwxr-xr-x 1 root root 5709195 Jun 2 11:47 redis-cli
    lrwxrwxrwx 1 root root 12 Jun 2 11:47 redis-sentinel -> redis-server
    -rwxr-xr-x 1 root root 7829986 Jun 2 11:47 redis-server
    
    # 常用命令存在,表示已经安装成功

    1.4 添加配置文件

    [root@node01 src]# mkdir /usr/local/redis/etc -p     # 创建配置文件目录
    [root@node01 ~]# cat /usr/local/redis/etc/redis6380.conf 
    daemonize yes
    pidfile /var/run/redis6380.pid
    port 6380
    timeout 0
    tcp-keepalive 0
    loglevel notice
    logfile stdout
    databases 16
    save 900 1
    save 300 10
    save 60 10000
    stop-writes-on-bgsave-error yes
    rdbcompression yes
    rdbchecksum yes
    dbfilename dump.rdb
    # 关闭保护模式
    protected-mode no 
    dir /data/redis/redis6380
    slave-serve-stale-data yes
    slave-read-only yes
    repl-disable-tcp-nodelay no
    slave-priority 100
    appendonly no
    appendfsync everysec
    no-appendfsync-on-rewrite no
    auto-aof-rewrite-percentage 100
    auto-aof-rewrite-min-size 64mb
    lua-time-limit 5000
    slowlog-log-slower-than 10000
    slowlog-max-len 128
    hash-max-ziplist-entries 512
    hash-max-ziplist-value 64
    list-max-ziplist-entries 512
    list-max-ziplist-value 64
    set-max-intset-entries 512
    zset-max-ziplist-entries 128
    zset-max-ziplist-value 64
    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
    [root@node01 ~]# 

    1.5 创建数据目录

    [root@node01 src]# mkdir /data/redis/redis6380 -p

     1.6 启动服务

    [root@node01 ~]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis6380.conf 

    1.7 检查启动并添加自动配置

    [root@node01 ~]# ps -ef |grep redis
    root     22036 21963  0 13:03 pts/0    00:00:00 grep redis
    root     27911     1  0 Mar02 ?        00:01:54 /usr/local/redis/bin/redis-server *:6380                                                      
    [root@node01 ~]# cat /etc/rc.local 
    #!/bin/sh
    #
    # This script will be executed *after* all the other init scripts.
    # You can put your own initialization stuff in here if you don't
    # want to do the full Sys V style init stuff.
    
    touch /var/lock/subsys/local
    /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis6380.conf
    [root@node01 ~]#

    1.8 测试redis服务

    [root@node01 ~]# /usr/local/redis/bin/redis-cli -h 172.24.129.3 -p 6380
    172.24.129.3:6380> set key 123
    OK
    172.24.129.3:6380> get key 
    "123"
    172.24.129.3:6380> 
    
    # 能设置值,并且还能获取到值表示所有操作配置已经完成
    
    
  • 相关阅读:
    Codeforces466C Number of Ways
    hdu 4902 Nice boat--2014 Multi-University Training Contest 4
    怎样免费设置QQ空间背景音乐
    “小懒虫”安卓手机控制电脑关机
    js和jquery实现回到顶层
    机器学习概念
    HDU 4786(最小生成树 kruskal)
    算法----堆排序(heap sort)
    openfireserver和jdk环境删除命令
    POI操作Excel导入和导出
  • 原文地址:https://www.cnblogs.com/supery007/p/8508427.html
Copyright © 2011-2022 走看看