Linux --- Redis Install

在这里插入图片描述

Linux --- Redis Install

    • 1.Download
    • 2.Install
    • 3.Close
    • 4.Openssl Create key/crt
    • 5.Error
      • 5.1 DENIDE Redis is running in protected
    • 6.Key
    • 7.GodFather


Document website: https://redis.io/docs/about/.
Linux --- Redis Install_第1张图片

Linux --- Redis Install_第2张图片

在一秒钟内看到本质的人和花半辈子也看不清一件事本质的人,自然是不一样的命运。


1.Download

Redis download website: https://download.redis.io/releases/.
Linux --- Redis Install_第3张图片

2.Install

  • 要么直接在服务器上下载
    wget https://download.redis.io/releases/redis-6.2.6.tar.gz
  • 要么本地下载上传
    yum install -y lrzsz
    rz
  • 解压
    tar -zxvf redis-6.2.6.tar.gz
    Linux --- Redis Install_第4张图片
  • 安装gcc
    yum -y install gcc
  • 进入redis
    cd redis-6.2.6
  • 编译
    不加密 => make
    加密 => make BUILD_TLS=yes
    configure ssl: https://redis.io/docs/manual/security/encryption/.Linux --- Redis Install_第5张图片
  • 安装
    sudo make install
    Linux --- Redis Install_第6张图片
  • 启动
    不加密 =>redis-server
    Linux --- Redis Install_第7张图片
    不加密 =>redis-cli
    在这里插入图片描述
    加密 =>cd src
    Linux --- Redis Install_第8张图片
    加密=>redis-server执行下面命令
    Linux --- Redis Install_第9张图片
    Linux --- Redis Install_第10张图片
    加密=>再执行redis-cli命令
    在这里插入图片描述
    加密=>redis-cli也要加密
    Linux --- Redis Install_第11张图片
  redis-server --tls-port 6379 --port 0 \
     --tls-cert-file /home/xxx/airflow/openssl/ca.crt \
     --tls-key-file /home/xxx/airflow/openssl/ca.key \
     --tls-ca-cert-file /home/xxx/airflow/openssl/ca.crt

  redis-cli --tls \
     --cert /home/xxx/airflow/openssl/ca.crt \
     --key /home/xxx/airflow/openssl/ca.key \
     --cacert /home/xxxx/airflow/openssl/ca.crt

3.Close

  • 关闭服务,查询pid
    ps -ef | grep redis
    在这里插入图片描述
    netstat -npl
  • kill pid
    kill -9 pid
  • 通过redis-cli命令关闭
    redis-cli shutdown

4.Openssl Create key/crt

使用 OpenSSL 创建ssl证书: https://blog.csdn.net/weixin_43916074/article/details/125997752.

CA根证书的生成

  • Generate CA private key
    openssl genrsa -out ca.key 2048
  • Generate CSR
    openssl req -new -key ca.key -out ca.csr
  • Generate Self Signed certificate(CA 根证书)
    openssl x509 -req -days 750 -in ca.csr -signkey ca.key -out ca.crt

5.Error

5.1 DENIDE Redis is running in protected

DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the lookback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the --portected-mode no option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
  • 修改redis.conf
    protected-mode no
    # bind 127.0.0.1 -::1
  • 启动指向配置文件(此处是两个点)
    redis-server …/redis.conf
  • 加密启动和上面一样
    redis-server …/redis.conf 后面继续

6.Key

  • 获取redis里面所有的keys
    在这里插入图片描述

7.GodFather

我是个迷信的人,若是他不幸发生意外,或被警察开枪打死,或在牢里上吊,或是他被闪电击中,那我会怪罪这个房间里的每一个人,到那时候我就不会再客气了…
Linux --- Redis Install_第12张图片

你可能感兴趣的:(Linux,redis,linux)