Код: Выделить всё
Failed to open redis DB connection (xx.xx.xx.xx:6379, database=0): 99 - Cannot assign requested address
/opt/www/project.com/yii2/vendor/yiisoft/yii2-redis/Connection.php
Line: 294
StackTrace:
Код: Выделить всё
#0 /opt/www/project.com/yii2/vendor/yiisoft/yii2-redis/Connection.php(383): yii\redis\Connection->open()
#1 /opt/www/project.com/yii2/vendor/yiisoft/yii2-redis/Session.php(117): yii\redis\Connection->executeCommand('GET', Array)
#2 [internal function]: yii\redis\Session->readSession('dasfserwef...')
#3 /opt/www/project.com/yii2/vendor/yiisoft/yii2/web/Session.php(127): session_start()
#4 /opt/www/project.com/yii2/vendor/yiisoft/yii2/web/Session.php(841): yii\web\Session->open()
#5 /opt/www/project.com/yii2/config/common_params.php(14): yii\web\Session->offsetGet('User_sid')
#6 /opt/www/project.com/yii2/models/User.php(137): {closure}()
#7 /opt/www/project.com/yii2/models/User.php(71): app\models\User->initSid()
#8 /opt/www/project.com/yii2/vendor/yiisoft/yii2/base/Object.php(107): app\models\User->init()
#9 [internal function]: yii\base\Object->__construct(Array)
#10 /opt/www/project.com/yii2/vendor/yiisoft/yii2/di/Container.php(366): ReflectionClass->newInstanceArgs(Array)
#11 /opt/www/project.com/yii2/vendor/yiisoft/yii2/di/Container.php(151): yii\di\Container->build('app\\models\\Cash...', Array, Array)
#12 /opt/www/project.com/yii2/vendor/yiisoft/yii2/BaseYii.php(340): yii\di\Container->get('app\\models\\Cash...', Array)
#13 /opt/www/project.com/yii2/vendor/yiisoft/yii2/di/ServiceLocator.php(133): yii\BaseYii::createObject('app\\models\\Cash...')
#14 /opt/www/project.com/yii2/vendor/yiisoft/yii2/di/ServiceLocator.php(71): yii\di\ServiceLocator->get('User')
#15 /opt/www/project.com/yii2/controllers/UserDataController.php(47): yii\di\ServiceLocator->__get('User')
#16 /opt/www/project.com/yii2/controllers/UserDataController.php(32): app\controllers\UserDataController->getCashpadCode()
#17 [internal function]: app\controllers\UserDataController->actionGet()
#18 /opt/www/project.com/yii2/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#19 /opt/www/project.com/yii2/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#20 /opt/www/project.com/yii2/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('get', Array)
#21 /opt/www/project.com/yii2/vendor/yiisoft/yii2/web/Application.php(84): yii\base\Module->runAction('User-data/ge...', Array)
#22 /opt/www/project.com/yii2/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#23 /opt/www/project.com/yii2/web/index.php(12): yii\base\Application->run()
#24 {main}
Код: Выделить всё
/**
* @var integer Bitmask field which may be set to any combination of connection flags passed to [stream_socket_client()](http://php.net/manual/en/function.stream-socket-client.php).
* Currently the select of connection flags is limited to `STREAM_CLIENT_CONNECT` (default), `STREAM_CLIENT_ASYNC_CONNECT` and `STREAM_CLIENT_PERSISTENT`.
* @see http://php.net/manual/en/function.stream-socket-client.php
* @since 2.0.5
*/
public $socketClientFlags = STREAM_CLIENT_CONNECT;
/**
* Establishes a DB connection.
* It does nothing if a DB connection has already been established.
* @throws Exception if connection fails
*/
public function open()
{
if ($this->_socket !== false) {
return;
}
$connection = ($this->unixSocket ?: $this->hostname . ':' . $this->port) . ', database=' . $this->database;
\Yii::trace('Opening redis DB connection: ' . $connection, __METHOD__);
$this->_socket = @stream_socket_client(
$this->unixSocket ? 'unix://' . $this->unixSocket : 'tcp://' . $this->hostname . ':' . $this->port,
$errorNumber,
$errorDescription,
$this->connectionTimeout ? $this->connectionTimeout : ini_get('default_socket_timeout'),
$this->socketClientFlags
);
if ($this->_socket) {
if ($this->dataTimeout !== null) {
stream_set_timeout($this->_socket, $timeout = (int) $this->dataTimeout, (int) (($this->dataTimeout - $timeout) * 1000000));
}
if ($this->password !== null) {
$this->executeCommand('AUTH', [$this->password]);
}
$this->executeCommand('SELECT', [$this->database]);
$this->initConnection();
} else {
\Yii::error("Failed to open redis DB connection ($connection): $errorNumber - $errorDescription", __CLASS__);
$message = YII_DEBUG ? "Failed to open redis DB connection ($connection): $errorNumber - $errorDescription" : 'Failed to open DB connection.';
throw new Exception($message, $errorDescription, $errorNumber);
}
}