Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual Excerpts from this Manual

MySQL 5.7 Reference Manual  /  ...  /  Troubleshooting the InnoDB memcached Plugin

14.17.8 Troubleshooting the InnoDB memcached Plugin

The following list shows some potential issues you might encounter using the InnoDB memcached plugin, and solutions or workarounds where available:

  • If you see this error in your MySQL error log, the server might fail to start:

    failed to set rlimit for open files. Try running as root or requesting
    smaller maxconns value.

    The error message is actually from the memcached daemon. One solution is to raise the OS limit for the number of open files. The command varies depending on the operating system. For example, here are the commands to check and increase the limit on several operating systems:

    # Linux
    $ ulimit -n
    ulimit -n 4096
    $ ulimit -n
    # OS X Lion (10.6)
    $ ulimit -n
    ulimit -n 4096
    $ ulimit -n

    The other solution is to reduce the number of concurrent connections available for the memcached daemon, using the -c option which defaults to 1024. Encode that memcached option using the MySQL option daemon_memcached_option inside the MySQL configuration file:

    loose-daemon_memcached_option='-c 64'
  • To troubleshoot problems where the memcached daemon is unable to store data in or retrieve data from the InnoDB table, specify the memcached option -vvv through the MySQL configuration option daemon_memcached_option. Examine the MySQL error log for debug output related to memcached operations.

  • If the column specified to hold the memcached item values is the wrong data type, such as a numeric type instead of a string type, attempts to store key/value pairs will fail with no specific error code or message.

  • If the daemon_memcached plugin causes any issues with starting the MySQL server, disable it during troubleshooting by adding this line under the [mysqld] group in your MySQL configuration file:


    For example, if you run the install plugin command before running the innodb_memcached_config.sql configuration script to set up the necessary database and tables, the server might crash and be unable to start. Or, if you set up an incorrect entry in the innodb_memcache.containers table, the server might be unable to start.

    To permanently turn off the memcached plugin for a MySQL instance, issue the following command:

    mysql> uninstall plugin daemon_memcached;
  • If you run more than one instance of MySQL on the same machine, with the memcached daemon plugin enabled in each, make sure to specify a unique memcached port for each one using the daemon_memcached_option configuration option.

  • You might find that a SQL statement cannot find an expected table, or there is no data in the table, but memcached API calls still work and retrieve the expected data. This can happen if you do not set up the entry in the innodb_memcache.containers table, or do not switch to that table by issuing a GET or SET request with the key @@table_id, or make a change to an existing entry in innodb_memcache.containers without restarting the MySQL server afterward. The free-form storage mechanism is flexible enough that your requests to store or retrieve a multi-column value like col1|col2|col3 will usually still work, even if the daemon is using the test.demo_test table which stores all the data within a single column.

  • When defining your own InnoDB table for use with InnoDB memcached, and columns in your table are defined as NOT NULL, ensure that values are supplied for the NOT NULL columns when inserting a descriptor for the InnoDB table into the memcached containers table (innodb_memcached.containers). If your descriptor INSERT statement contains fewer delimited values than there are mapped columns, unfilled columns are set to NULL. Attempting to insert a NULL value into a NOT NULL column causes the INSERT to fail, which may only become evident after you reinitialize the InnoDB memcached plugin to apply changes to the containers table.

  • If cas_column and expire_time_column of the innodb_memcached.containers table are set to NULL, the following error will be returned when attempting to load the memcached plugin:

    InnoDB_Memcached: column 6 in the entry for config table 'containers' in
    database 'innodb_memcache' has an invalid NULL value.

    The memcached plugin rejects usage of NULL in the cas_column and expire_time_column columns. Set the value of these columns to 0 if the columns are unused.

  • As the length of the memcached key and values increase, you encounter size and length limits at different points:

    • When the key exceeds 250 bytes in size, memcached operations return an error. This is currently a fixed limit within memcached.

    • You might encounter InnoDB-related limits when the value exceeds 768 bytes in size, or 3072 bytes in size, or the InnoDB row size limit which depends on innodb_page_size setting. These limits primarily apply if you intend to create an index on the value column to run report-generating queries on that column from SQL. See Section 14.5.7, “Limits on InnoDB Tables” for details.

    • The maximum size for the combination of the key and the value is 1 MB.

  • If you share configuration files across MySQL servers with different versions, using the latest configuration options for the memcached plugin could cause startup errors for older MySQL versions. To avoid compatibility problems, use the loose forms of these option names, for example loose-daemon_memcached_option='-c 64' instead of daemon_memcached_option='-c 64'.

  • There is no restriction or check in place to validate character set settings. memcached stores and retrieves keys and values in bytes and is therefore not character set sensitive. However, you must ensure that the memcached client and the MySQL table use the same character set.

Download this Manual
User Comments
Sign Up Login You must be logged in to post a comment.