请问redis-queue的tls连接方式

蚂蚁搬家

问题描述

请问 https://www.workerman.net/doc/workerman/components/workerman-redis-queue.html
Redis队列怎么加密连接 tls

[
        'host' => 'redis://127.0.0.1:1234',
        'options' => [
            'auth'     => 'testtest',     // 密码,可选参数
            'db' => 2,      // 数据库
            'max_attempts'  => 5, // 消费失败后,重试次数
            'retry_seconds' => 30, // 重试间隔,单位秒
         ]
    ]

我用了Redis7 Tls怎么都储存不了数据 用阿里云的可以

已经解决。
配置文件改成

[
        'host' => 'redis://127.0.0.1:1234',
        'options' => [
            'auth'     => 'testtest',     // 密码,可选参数
            'db' => 2,      // 数据库
            'max_attempts'  => 5, // 消费失败后,重试次数
            'retry_seconds' => 30, // 重试间隔,单位秒
            'ssl' => 1, // 0关闭 1开启
         ]
    ]

修改源码 /vendor/workerman/redis/src/Client.php
在328行 $this->_connection = new AsyncTcpConnection($this->_address, $context); 后 添加

 // 自行改造加密链接
 if($this->_options['ssl'] === 1){
    $this->_connection->transport = 'ssl';
 }
407 1 0
1个回答

蚂蚁搬家

已解决

  • 暂无评论
年代过于久远,无法发表回答
🔝