Configuration of innodb_memcache
Before innodb_memcache is installed, You need to import the configuration SQL, which is located in the share directory of the installation directory, and the file name is innodb_memcached_config. SQL, which can be imported to the database.
After the import, we find that there is an additional database innodb_memcache, which has three tables:
Cache_policies: cache policy table
Config_options: configuration option table
Containers: memcache metadata container table
1. cache_policies defines three cache policies: innodb_only: Use InnoDB to store data cache-only: use the traditional Memcached engine for storage. Caching: if you cannot find it in Memcached, query InnoDB.
2. config_options defines the delimiter used for the combination of multiple fields in the configuration information separator. The default value is | the delimiter between the table_map_delimiter table and the key. The default value is. if this parameter is modified, restart mysql or reinstall the memcache plug-in.
3. containers defines the metadata information of all memcache tables and keys name: defined name db_schema: Database db_table in which the table is located: field name corresponding to key_columns: key value_columns: the field name corresponding to the value. You can use | to concatenate the flags: memcache tag cas_column: String Length Field expire_time_column: expiration time unique_idx_name_on_key: name of the unique field index in the database.
4. other server control parameters: mysql> show variables like '% memcache % '; + dimensions + ------------------ + | Variable_name | Value | + dimensions + ---------------- + | dimensions | OFF | percent | innodb_engine.so | ||| daemon_memcached_option |-p | percent | 1 | | Parameter | 1 | + parameter + ---------------- + 6 rows in set (0.00 sec) indicates whether to write the set in memcache to binlog daemon_memcached_option: Default Option of innodb_memcache, you can use "-p 11222" to specify the ports daemon_memcached_r_batch_size and daemon_memcached_w_batch_size, which are related to the write and read performance of memcache. The default value is 1, indicating reading and writing from the innodb file every! Change as appropriate
5. CREATE a TABLE in one example: use test; create table 'users' ('id' INT (10) unsigned not null AUTO_INCREMENT, 'username' VARCHAR (15) not null, 'Password' VARCHAR (32) not null, 'email 'VARCHAR (50) not null, 'flags' INT (10) unsigned default '0 ', 'cas _ column' BIGINT (20) unsigned default '0', 'expire _ time_column 'INT (10) unsigned default '0', primary key ('id '), unique key 'username' ('username') ENGINE = INNODB; write data: insert into 'users' ('username', 'Password', 'email ') VALUES ('test1', 'test1', 'test2 @ bkjia.com '), ('test2', 'test2', 'test2 @ bkjia.com'); write to the memcache metadata table: insert into values (NAME, db_schema, db_table, key_columns, value_columns, flags, cas_column, expire_time_column, VALUES) VALUES ('default', 'test', 'users', 'username ', 'password | email ', 'flags', 'cas _ column', 'expire _ time_column ', 'username'); get data: [root @ www share] # echo 'get @ default. test1' | nc localhost 11222 VALUE @ default. test1 0 19 test1 | test2@bkjia.com END [root @ www share] # echo 'get @ default. test2 '| nc localhost 11222 VALUE @ default. test2 0 19 test2 | END Of The test2@bkjia.com
Use of innodb_memcache
Install innodb_memcache
Configuration of innodb_memcache
Architecture of MySQL Server layer and InnoDB Engine Layer
This article permanently updates the link address: