• redis的安装及使用


    LINUX

    1.安装相关软件make gcc tcl wget,可分开安装,也可一个一个安装

    ubuntu: apt-get install make gcc tcl wget

    centos: yum -y install make gcc tcl wget

    2.下载

    官网:https://redis.io/

    下载

    执行 wget https://download.redis.io/releases/redis-6.0.8.tar.gz

    3.解压、编译

    tar -zvxf redis-6.0.8.tar.gz

    编译

    cd redis-6.0.8

    make MALLOC=libc

    make install(只是把src下的可执行程序拷贝到了/usr/local/bin,可通过执行make install PREFIX=/usr/local/redis将可执行程序拷贝到/usr/local/redis目录)

    4.修改配置

    vim redis.conf

    守护线程模式(后台启动)  daemon yes

    远程登录

    注释掉 bind 127.0.0.1

    保护模式关闭 protetced-mode no

    设置密码

    requirepass 123456

    5.启动

    cd src

    ./redis-server ../redis.conf

    6.客户端连接

    ./redis-cli -h 127.0.0.1 -p 6379

    密码认证AUTH 123456

    或者./redis-cli -h 127.0.0.1 -p 6379 -a 123456

    7.优雅关闭

    客户端输入shutdown

    8.redis安装为服务

    vim /etc/profile

    export REDIS_HOME=/usr/local/redis

    export PATH=$PATH:$REDIS_HOME/bin

    source /etc/profile

    cd /utils

    vim install_server.sh

    注释掉

    #bail if this system is managed by systemd
    #_pid_1_exe="$(readlink -f /proc/1/exe)"
    #if [ "${_pid_1_exe##*/}" = systemd ]
    #then
    # echo "This systems seems to use systemd."
    # echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
    # exit 1
    #fi

    ./install_server.sh 

    一台服务器上的redis可以有多个实例,可以指定不同的配置文件/日志/实例

  • 相关阅读:
    Kubernetes DNS服务配置案例
    Dockerfile常用指令
    Docker常用命令
    Kubernetes常用命令
    阿里云ECS安装Kubernetes问题收集与解答
    712. Minimum ASCII Delete Sum for Two Strings
    845. Longest Mountain in Array
    815. Bus Routes
    204. Count Primes
    190. Reverse Bits
  • 原文地址:https://www.cnblogs.com/scorates/p/13808874.html
Copyright © 2020-2023  润新知