Linux|Linux --- Redis Install

Linux|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|Linux --- Redis Install
文章图片

Linux|Linux --- Redis Install
文章图片

在一秒钟内看到本质的人和花半辈子也看不清一件事本质的人,自然是不一样的命运。
1.Download Redis download website: https://download.redis.io/releases/.
Linux|Linux --- Redis Install
文章图片

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|Linux --- Redis Install
    文章图片
  • 安装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|Linux --- Redis Install
    文章图片
  • 安装
    sudo make install
    Linux|Linux --- Redis Install
    文章图片
  • 启动
    不加密 =>redis-server
    Linux|Linux --- Redis Install
    文章图片

    不加密 =>redis-cli
    Linux|Linux --- Redis Install
    文章图片

    加密 =>cd src
    Linux|Linux --- Redis Install
    文章图片

    加密=>redis-server执行下面命令
    Linux|Linux --- Redis Install
    文章图片

    Linux|Linux --- Redis Install
    文章图片

    加密=>再执行redis-cli命令
    Linux|Linux --- Redis Install
    文章图片

    加密=>redis-cli也要加密
    Linux|Linux --- Redis Install
    文章图片
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.crtredis-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
    Linux|Linux --- Redis Install
    文章图片

    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.
【Linux|Linux --- Redis Install】 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
    Linux|Linux --- Redis Install
    文章图片
7.GodFather
我是个迷信的人,若是他不幸发生意外,或被警察开枪打死,或在牢里上吊,或是他被闪电击中,那我会怪罪这个房间里的每一个人,到那时候我就不会再客气了…
Linux|Linux --- Redis Install
文章图片

    推荐阅读