I
I
Ilya Trusov2016-02-24 09:09:19
PHP
Ilya Trusov, 2016-02-24 09:09:19

How to set up memcached on another server?

Hello. Such situation. There are several servers. Configuration: ubuntu 14.04, nginx, php-fpm, Software on codeigniter v3. There is a separate server. Empty, no LEMP/LAMP. Put memcached there: apt-get install memcached. On the servers where the software was installed: apt-get install php5-memcached. On the server where memcached in its config specified server ip. Am I doing the right thing? If not, how do you set it up? Does memcached itself need LEMP/LAMP?
PS This is all done for sessions for codeigniter.

$config['sess_driver'] = 'memcached';
$config['sess_cookie_name'] = 'name_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ip_serve_memcached :11211';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I did, but:
A PHP Error was encountered

Severity: Warning

Message: Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php5)

Filename: Unknown

Line Number: 0

Backtrace:

Backtrace for some reason did not display.
Another incomprehensibility. On servers where the software itself is, I do this: ps aux | grep memcached
Output:
root 18943 0.0 0.0 12968 888 pts/0 S+ 09:15 0:00 grep --color=auto memcached
But that's definitely not memcached. And even if you do apt-get remove memcached the package will not be found.
Street magic.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2016-02-24
@Nc_Soft

check the connection
telnet ip_serve_memcached 11211

Y
Yuri Chudnovsky, 2016-02-24
@Frankenstine

On servers where the software itself is, I do this: ps aux | grep memcached<'ip_serve_memcached :11211'/blockquote>
And you get in the output the grep command itself, which is currently searching :)
To prevent grep from getting into the output of your own search, do something like this:
ps aux | grep memcac[h]ed
I hope you have a gap here only in the quota, and not in the config

O
Oleg Krasavin, 2016-02-24
@okwinza

  1. LAMP/LEMP is not needed by the memcached.
    That is, in the case of multiple servers
    $config = array(
      'default' => array(
        'hostname' => '127.0.0.1',
        'port'     => '11211',
        'weight'   => '1',
      ),
      'someCoolName' => array(
        'hostname' => '8.8.8.8',
        'port'     => '11211',
        'weight'   => '5',
      ),
    );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question