Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql 5.7innodb memcached plugin supports main memory database

Shulou Source: shulou.com Published: 2022-06-01 13:45:09 09月20日 Update

Http://dev.mysql.com/doc/refman/5.7/en/innodb-memcached.html

I. Test environment

Mysql:5.7.15

Centos:6.6_x86_64

II. Installation and deployment

1. Install libevent

# yum install libevent-y

two。 Perform configuration sql

# find /-name innodb_memcached_config.sql

(root@localhost) [(none)] > source / usr/share/mysql/innodb_memcached_config.sql

3. Load plug-in

(root@localhost) [test] > INSTALL PLUGIN daemon_memcached soname "libmemcached.so"

III. Testing

1. Table generated by default

(root@localhost) [test] > show tables

+-+

| | Tables_in_test |

+-+

| | demo_test |

+-+

1 row in set (0.00 sec)

two。 Table structure

(root@localhost) [test] > show create table demo_test\ G

* * 1. Row *

Table: demo_test

Create Table: CREATE TABLE `demo_ test` (

`c1` varchar (32) NOT NULL

`c2` varchar (1024) DEFAULT NULL

`c3` int (11) DEFAULT NULL

`c4` bigint (20) unsigned DEFAULT NULL

`c5` int (11) DEFAULT NULL

PRIMARY KEY (`c1`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8

1 row in set (0.00 sec)

ERROR:

No query specified

3. Table data

(root@localhost) [test] > select * from demo_test

+-- +

| | C1 | c2 | c3 | c4 | c5 |

+-- +

| | AA | HELLO, HELLO | 8 | 0 | 0 | |

+-- +

1 row in set (0.00 sec)

4. Generate database

(root@localhost) [test] > show databases

+-+

| | Database |

+-+

| | information_schema |

| | innodb_memcache |-- newly generated |

| | mysql |

| | performance_schema |

| | test |

+-+

5. Newly generated table

(root@localhost) [test] > use innodb_memcache

Database changed

(root@localhost) [innodb_memcache] > show tables

+-+

| | Tables_in_innodb_memcache |

+-+

| | cache_policies |

| | config_options |

| | containers |

+-+

6. Table structure and content

(root@localhost) [innodb_memcache] > select * from containers\ G

* * 1. Row *

Name: aaa

Db_schema: test

Db_table: demo_test

Key_columns: c1

Value_columns: c2

Flags: c3

Cas_column: c4

Expire_time_column: c5

Unique_idx_name_on_key: PRIMARY

1 row in set (0.00 sec)

ERROR:

No query specified

7.memcache default port 11211, which can be modified

[root@mysql5 ~] # netstat-antp | grep 11211

Tcp 0 0 0.0.0.0 11211 0.0.0.015 * LISTEN 4241/mysqld

Tcp 0 0: 11211: * LISTEN 4241/mysqld

8. Install test commands

# yum install telnet nc

9. Use telnet to read and write

[root@mysql5 ~] # telnet localhost 11211

Trying:: 1...

Connected to localhost.

Escape character is'^]'.

Get AA

VALUE AA 8 12

HELLO, HELLO

END

Set BB 10 0 16

GOODBYE, GOODBYE

STORED

10. Verify that the data is modified

(root@localhost) [test] > select * from demo_test

+-- +

| | C1 | c2 | c3 | c4 | c5 |

+-- +

| | AA | HELLO, HELLO | 8 | 0 | 0 | |

| | BB | GOODBYE, GOODBYE | 10 | 1 | 0 |-data has been modified |

+-- +

Specific theory, look at the official documents.

Http://dev.mysql.com/doc/refman/5.7/en/innodb-memcached.html

Tags: Data testing newborn structure generation database content command official plug-in documentation environment theory port configuration verification memory support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Redmi Docker vpn Shulou Tech Info