Automatically assign aliases to slave connections.

This commit is contained in:
Daniele Alessandri
2016-05-10 14:55:30 +02:00
parent 7664f1f29b
commit e851aaa21d
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ $current = $client->getConnection()->getCurrent()->getParameters();
echo "We fetched 'foo' from {$current->alias} and its value is '$bar'.", PHP_EOL;
/* OUTPUT:
Does 'foo' exist on slave? yes.
Does 'foo' exist on slave-127.0.0.1:6381? yes.
Now 'foo' has been set to 'bar' on master!
We fetched 'foo' from master and its value is 'bar'.
*/
@@ -240,6 +240,7 @@ class SentinelReplication extends MasterSlaveReplication
$slaves[] = array(
'host' => $slave[3],
'port' => $slave[5],
'alias' => "slave-$slave[3]:$slave[5]",
);
}