Welcome Guest, Not a member yet? Register   Sign In
Two memcached servers for sessions
#1

Hello,
Im using latest CI3.

I have started two memcached instances - 127.0.0.1:12345 and 127.0.0.1:12346

Now in my config.php I have:

PHP Code:
$config['sess_driver']  'memcached';
$config['sess_save_path'] = '127.0.0.1:12345,127.0.0.1:12346'

my php.ini:
Code:
memcached.sess_number_of_replicas = 2
memcached.sess_consistent_hash = on
memcached.sess_remove_failed_servers = on
memcached.sess_server_failure_limit = 3
memcached.store_retry_count = 2

Now when both of the memcached instances are on, it works.
When I turn off the first and keep the second on, it works.

But when I turn off the second and keep the first on, it does not work - it tries for 12 seconds and then I have this error:

Message: session_start(): Failed to read session data: user (path: c:/wamp64/tmp)
Reply
#2

PHP Code:
array (size=2)
  0 => 
    array (size=3)
      'host' => string '127.0.0.1' (length=9)
      'port' => int 12345
      
'type' => string 'TCP' (length=3)
  1 => 
    array (size=3)
      'host' => string '127.0.0.1' (length=9)
      'port' => int 12346
      
'type' => string 'TCP' (length=3

this is dump from:

PHP Code:
var_dump($this->_memcached->getServerList ( )); 
Reply
#3

I see, memcached does not support replication. I should go with redis.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB