zoukankan      html  css  js  c++  java
  • redis安装过程中遇到的问题

    正常的

    wget http://download.redis.io/releases/redis-3.0.7.tar.gz下载

    解压缩

    tar -zxvf redis-3.0.7.tar.gz

    cd redis-3.0.7

    这全很正常没有什么可以说的,主要是下面,进入到redis-3.0.7目录之后,要是执行

    make

    make install 会把redis默认安装到/usr/local/bin/redis下

    但是我只是一个普通的redis用户,我不想给他sudo权限也不想用root去执行怎么办呢

    方法是:

    bash-4.1$ PREFIX=/opt/redis make
    bash-4.1$ PREFIX=/opt/redis make install
    cd src && make install
    make[1]: Entering directory `/opt/redis/redis-3.0.7/src'
    
    Hint: It's a good idea to run 'make test' ;)
    
        INSTALL install
        INSTALL install
        INSTALL install
        INSTALL install
        INSTALL install
    make[1]: Leaving directory `/opt/redis/redis-3.0.7/src'
    bash-4.1$ pwd
    /opt/redis/redis-3.0.7
    bash-4.1$ cd ..
    bash-4.1$ ls -all
    total 1368
    drwxr-xr-x 5 redis redis    4096 May 30 19:29 .
    drwxr-xr-x 8 root  root     4096 May 30 19:24 ..
    drwxr-xr-x 2 redis redis    4096 May 30 19:29 bin
    drwxr-xr-x 6 redis redis    4096 Jan 25 22:57 redis-3.0.7
    -rw-r--r-- 1 redis redis 1375200 May 30 19:26 redis-3.0.7.tar.gz
    drwx------ 2 redis redis    4096 May 30 19:26 .ssh

    指定到你想要安装的目录下就可以了,大功告成

    接下来设置主备和哨兵

    Master(主)配置文件

    1 vi /opt/redis/6000/6000.conf
    2 
    3 port 6000
    4 daemonize yes
    5 appendonly yes
    6 save ""
    7 slave-read-only yes

    自己在redis目录下建立一个6000的文件夹

    Salve(从)配置文件

    1 vi /opt/redis/6101/6101.conf
    2 
    3 port 6101
    4 daemonize yes
    5 slaveof 10.171.132.17 6000  ----主的地址和端口,一看就明白
    6 appendonly yes
    7 save ""
    8 slave-read-only yes

    配置sentinel 1

    1 vi /opt/redis/6000/sentinel-6000.conf
    2 
    3 port 26000
    4 daemonize yes
    5 sentinel monitor mymaster 10.171.132.17 6000 2 --主的地址
    6 sentinel down-after-milliseconds mymaster 5000
    7 sentinel failover-timeout mymaster 60000
    8 sentinel config-epoch mymaster 676
    9 sentinel leader-epoch mymaster 676

    配置sentinel 2

    vi /opt/redis/6101/sentinel-6101.conf
    
    port 26101
    daemonize yes
    sentinel monitor mymaster 10.171.132.17 6000 2
    sentinel down-after-milliseconds mymaster 5000
    sentinel failover-timeout mymaster 60000
    sentinel config-epoch mymaster 676
    sentinel leader-epoch mymaster 676

    然后再启动下:

    ./redis-server --include /opt/redis/6000/6000.conf
    ./redis-server --include /opt/redis/6101/6101.conf
    
    ./redis-sentinel /opt/redis/6000/sentinel-6000.conf
    ./redis-sentinel /opt/redis/6101/sentinel-6101.conf

    这样子redis就安装配置好了~而且是用最普通的用户实现的,保证了系统权限的划分。

  • 相关阅读:
    数据结构实验报告(四)
    数据结构实验报告(三)
    数据结构实验报告(一)
    数据结构实验报告(二)
    Java基础之排序
    1070 Mooncake
    1071 Speech Patterns
    1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
    5403. Find the Kth Smallest Sum of a Matrix With Sorted Rows
    1072 Gas Station
  • 原文地址:https://www.cnblogs.com/tian880820/p/5543707.html
Copyright © 2011-2022 走看看